Fix log position to avoid errno change. (errno can be changed when using dlog) 15/197115/1 accepted/tizen/5.0/unified/20190110.060408 submit/tizen_5.0/20190110.010812
authorMinje Ahn <minje.ahn@samsung.com>
Wed, 9 Jan 2019 08:32:03 +0000 (17:32 +0900)
committerjiyong.min <jiyong.min@samsung.com>
Wed, 9 Jan 2019 23:52:12 +0000 (08:52 +0900)
Change-Id: Ie8aac74cc9c9a2d47ac77905ed49bddcc717f113
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
Fix the log position to avoid errno change. (errno can be changed when using dlog)

Change-Id: I4a81986414f8a5b5dc252b888c19410bc324b1a1

src/media_util_private.c

index ac8cd0a..cf69eff 100755 (executable)
@@ -64,12 +64,15 @@ int _media_util_check_file_exist(const char *path)
        /* check the file exits actually */
        exist = open(path, O_RDONLY);
        if (exist < 0) {
-               media_content_sec_debug("path [%s]", path);
-               media_content_stderror("open file fail");
-               if (errno == EACCES || errno == EPERM)
+               if (errno == EACCES || errno == EPERM) {
+                       media_content_stderror("open file fail");
+                       media_content_sec_debug("path [%s]", path);
                        return MEDIA_CONTENT_ERROR_PERMISSION_DENIED;
-               else
+               } else {
+                       media_content_stderror("open file fail");
+                       media_content_sec_debug("path [%s]", path);
                        return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+               }
        }
 
        close(exist);
@@ -300,13 +303,15 @@ int _media_content_check_dir(const char *path)
 #endif
        dp = opendir(path);
        if (dp == NULL) {
-               media_content_sec_error("path [%s]", path);
-               media_content_stderror("open dir fail");
-
-               if (errno == EACCES || errno == EPERM)
+               if (errno == EACCES || errno == EPERM) {
+                       media_content_stderror("open dir fail");
+                       media_content_sec_error("path [%s]", path);
                        return MEDIA_CONTENT_ERROR_PERMISSION_DENIED;
-               else
+               } else {
+                       media_content_stderror("open dir fail");
+                       media_content_sec_error("path [%s]", path);
                        return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+               }
        }
 
        closedir(dp);