Fix return value when access failure 88/229288/1 accepted/tizen_5.5_unified accepted/tizen_5.5_unified_wearable_hotfix tizen_5.5 tizen_5.5_wearable_hotfix accepted/tizen/5.5/unified/20200331.180152 accepted/tizen/5.5/unified/wearable/hotfix/20201027.121820 submit/tizen_5.5/20200331.035412 submit/tizen_5.5_wearable_hotfix/20201026.184302
authorMinje Ahn <minje.ahn@samsung.com>
Tue, 31 Mar 2020 03:33:58 +0000 (12:33 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Tue, 31 Mar 2020 03:33:58 +0000 (12:33 +0900)
Change-Id: I0fa8d10fc63b776127fb9ad27c4f53d021d967fa
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
src/thumbnail_util.c

index 88e42925eaee206e7d866d2cd354de53397662b6..7045c56657d2c4496a9f07972d3aadeec8c325c1 100644 (file)
@@ -602,16 +602,21 @@ int thumbnail_util_extract_to_file(const char *path, unsigned int width, unsigne
 
        /* check thumbnail path is writable */
        check_str = g_path_get_dirname(thumbnail_path);
-       if (check_str != NULL) {
-               if (access(check_str, W_OK) != 0) {
+       if (access(check_str, W_OK) != 0) {
+               if (errno == EACCES || errno == EPERM) {
                        thumbnail_util_error("No permission to write[%s]", check_str);
-                       SAFE_FREE(check_str);
-                       return THUMBNAIL_UTIL_ERROR_PERMISSION_DENIED;
+                       ret = THUMBNAIL_UTIL_ERROR_PERMISSION_DENIED;
                } else {
-                       SAFE_FREE(check_str);
+                       thumbnail_util_error("Does not exists[%s]", check_str);
+                       ret = THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER;
                }
+
+               SAFE_FREE(check_str);
+               return ret;
        }
 
+       SAFE_FREE(check_str);
+
        /* If video file, thumbnail extension is only JPEG */
        if (type == THUMBNAIL_UTIL_VIDEO) {
                char ext[255] = { 0 };