int _thumbnail_util_check_media_type(const char *path, thumbnail_util_media_type_e *type)
{
int ret = 0;
- int exist = 0;
char mimetype[255] = {0,};
const char *unsupported_type = "image/tiff";
const char *supported_type = "application/vnd.ms-asf";
// Check file is existed
thumbnail_util_retv_if(path == NULL, THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER);
- exist = open(path, O_RDONLY);
- if (exist < 0) {
+ if (access(path, R_OK) < 0) {
if (errno == EACCES || errno == EPERM) {
thumbnail_util_error("Fail to open path: Permission Denied [%s]", path);
return THUMBNAIL_UTIL_ERROR_PERMISSION_DENIED;
return THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER;
}
}
- close(exist);
// Check media type
ret = aul_get_mime_from_file(path, mimetype, sizeof(mimetype));