app need to rename folder in tv
[platform/core/api/media-content.git] / src / media_util_private.c
index 64a608a..65b7a1a 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);
@@ -85,7 +88,7 @@ void _media_util_trim_path(const char *input_path, char **output_path)
 
        memset(buf, 0, sizeof(buf));
        if (!SAFE_STRLCPY(buf, input_path, sizeof(buf)))
-               media_content_sec_debug("Truncation occurred[%d]", strlen(input_path));
+               media_content_sec_debug("Truncation occurred[%zu]", strlen(input_path));
 
        while ((pos = strstr(buf, "//")) != NULL) {
                memset(tmp, 0, sizeof(tmp));
@@ -95,7 +98,7 @@ void _media_util_trim_path(const char *input_path, char **output_path)
 
                memset(buf, 0, sizeof(buf));
                if (!SAFE_STRLCPY(buf, tmp, sizeof(buf)))
-                       media_content_sec_debug("Truncation occurred[%d]", strlen(tmp));
+                       media_content_sec_debug("Truncation occurred[%zu]", strlen(tmp));
        }
 
        if (g_str_has_suffix(buf, "/"))
@@ -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);