static int __check_thumb_path_validity(const char *path)
{
char *dir_name = NULL;
+ int ret = MS_MEDIA_ERR_NONE;
thumb_retvm_if(!path, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid path");
dir_name = g_path_get_dirname(path);
- if (dir_name) {
- if (access(dir_name, W_OK) != 0) {
+
+ if (access(dir_name, W_OK) != 0) {
+ if (errno == EACCES || errno == EPERM) {
thumb_err("No permission to write[%s]", dir_name);
- SAFE_FREE(dir_name);
- return MS_MEDIA_ERR_PERMISSION_DENIED;
+ ret = MS_MEDIA_ERR_PERMISSION_DENIED;
+ } else {
+ thumb_err("Does not exists[%s]", dir_name);
+ ret = MS_MEDIA_ERR_INVALID_PARAMETER;
}
-
- SAFE_FREE(dir_name);
}
- return MS_MEDIA_ERR_NONE;
+ SAFE_FREE(dir_name);
+
+ return ret;
}
static int __check_parameter_validity_for_file(const char *path, unsigned int width, unsigned int height, const char *thumb_path)