fix invalid format argument types for dlog 26/135126/2 accepted/tizen/unified/20170630.083308 submit/tizen/20170621.064821 submit/tizen/20170622.044226
authorHaejeong Kim <backto.kim@samsung.com>
Wed, 21 Jun 2017 04:50:03 +0000 (13:50 +0900)
committerHaejeong Kim <backto.kim@samsung.com>
Wed, 21 Jun 2017 05:29:39 +0000 (14:29 +0900)
Change-Id: Ie859956a7af6129b935b4c10c56013914fffabc4

17 files changed:
lib/include/media-util-dbg.h
lib/media-util-cynara.c
lib/media-util-db.c
lib/media-util-ipc.c
lib/media-util-noti-internal.c
lib/media-util-user.c
packaging/media-server.spec
src/common/include/media-common-dbg.h
src/common/media-common-db-svc.c
src/common/media-common-external-storage.c
src/common/media-common-utils.c
src/scanner-v2/media-scanner-extract-v2.c
src/scanner-v2/media-scanner-scan-v2.c
src/scanner/media-scanner-scan.c
src/server/media-server-dcm.c
src/server/media-server-socket.c
src/server/media-server-thumb.c

index c578cb6..7b36579 100755 (executable)
@@ -44,8 +44,8 @@
 #define FONT_COLOR_GRAY     "\033[37m"
 
 #define MSAPI_DBG_STRERROR(fmt) do { \
-                       char buf[BUF_LENGTH] = {0,}; \
-                       LOGE(FONT_COLOR_RED""fmt""" : STANDARD ERROR [%s]"FONT_COLOR_RESET, strerror_r(errno, buf, BUF_LENGTH)); \
+                       char stderror_buffer[BUF_LENGTH] = {0,}; \
+                       LOGE(FONT_COLOR_RED""fmt""" : STANDARD ERROR [%s]"FONT_COLOR_RESET, strerror_r(errno, stderror_buffer, BUF_LENGTH)); \
                } while (0)
 
 #define MSAPI_DBG_SLOG(fmt, arg...) do { \
index 742984c..7625eb0 100755 (executable)
@@ -28,8 +28,6 @@
  * @brief
  */
 
-#define _GNU_SOURCE
-
 #include <errno.h>
 #include <glib.h>
 #include <stdio.h>
index 89c0da1..3021647 100755 (executable)
@@ -19,7 +19,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
index 22e8b98..ae01f3a 100755 (executable)
@@ -19,7 +19,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include <string.h>
 #include <unistd.h>
 #include <errno.h>
index 36373e7..4391bb0 100755 (executable)
@@ -302,7 +302,7 @@ static int _find_handle(MediaNotiHandle handle, int *idx)
        if (handle_list_internal != NULL) {
                for (i = 0; i < handle_list_internal->len; i++) {
                        data = g_array_index(handle_list_internal , MediaNotiHandle, i);
-                       MSAPI_DBG_INFO("%x %x", handle, data);
+                       MSAPI_DBG_INFO("%p %p", handle, data);
                        if (data == handle) {
                                MSAPI_DBG("FIND HANDLE");
                                *idx = i;
index a3b412b..7fb4648 100755 (executable)
@@ -21,6 +21,8 @@
 #include "media-util-internal.h"
 #include "media-util.h"
 #include <glib.h>
+#include <unistd.h>
+#include <sys/types.h>
 
 #ifdef _USE_SENIOR_MODE
 #include <system_info.h>
index 7b866ae..8d5b958 100755 (executable)
@@ -90,7 +90,7 @@ export CFLAGS="$CFLAGS -D_USE_SENIOR_MODE -D_USE_RECORDED_CONTENT -D_USE_SUSPEND
 %else
 export CFLAGS="$CFLAGS -D_USE_MULTI_USER -D_USE_META_UPDATE -D_USE_DEVICED_DBUS"
 %endif
-export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE -DSYSCONFDIR=\\\"%{_sysconfdir}\\\""
+export CFLAGS="$CFLAGS -D_GNU_SOURCE -DTIZEN_DEBUG_ENABLE -DSYSCONFDIR=\\\"%{_sysconfdir}\\\""
 export CFLAGS+=" -DPATH_LIBDIR=\\\"%{_libdir}\\\""
 rm -rf autom4te.cache
 rm -f aclocal.m4 ltmain.sh
index df965d3..2410c24 100755 (executable)
                SECURE_LOGD(FONT_COLOR_CYAN""fmt""FONT_COLOR_RESET, ##arg); \
                } } while (false)
 
+#define MS_DBG_SERR(fmt, arg...) do { if (true) { \
+                       SECURE_LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg); \
+                       } } while (false)
+
 #define MS_DBG(fmt, arg...) do { if (true) { \
                LOGD(FONT_COLOR_RESET""fmt"", ##arg); \
                } } while (false)
index 94fda99..fdcf5ea 100755 (executable)
@@ -1317,7 +1317,7 @@ int ms_get_folder_id(void **handle, const char *storage_id, const char *path, ch
                *folder_id = NULL;
        }
 
-       MS_DBG("folder_id [%s]", folder_id);
+       MS_DBG("folder_id [%s]", *folder_id);
 
        return res;
 }
index 8acfcc1..293122a 100755 (executable)
@@ -18,7 +18,7 @@
  * limitations under the License.
  *
  */
-#define _GNU_SOURCE
+
 #include <fcntl.h>
 #include <stdio.h>
 #include <unistd.h>
index 4ab2570..6b328d3 100755 (executable)
@@ -19,7 +19,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include <sys/types.h>
 #include <fcntl.h>
 #include <errno.h>
@@ -319,6 +318,11 @@ int ms_check_file_path(const char *file_path, uid_t uid)
        ms_user_storage_type_t storage_type = -1;
        int ret = MS_MEDIA_ERR_NONE;
 
+       if (!MS_STRING_VALID(file_path)) {
+               MS_DBG_ERR("Invalid path");
+               return MS_MEDIA_ERR_INVALID_PARAMETER;
+       }
+
        /* check location of file */
        /* file must exists under "/opt/usr/media" or "/opt/storage/sdcard" */
        ret = ms_user_get_storage_type(uid, file_path, &storage_type);
@@ -327,7 +331,7 @@ int ms_check_file_path(const char *file_path, uid_t uid)
        /* check the file exits actually */
        exist = open(file_path, O_RDONLY);
        if (exist < 0) {
-               MS_DBG_ERR("[%s]open files");
+               MS_DBG_SERR("open file fail [%s]", file_path);
                return MS_MEDIA_ERR_INVALID_PATH;
        }
        close(exist);
index 9b0ee5b..d738c8e 100755 (executable)
@@ -19,7 +19,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include <dirent.h>    /* Defines DT_* constants */
 #include <fcntl.h>
 #include <stdio.h>
index 7b1e5e1..b81e4d3 100755 (executable)
@@ -19,7 +19,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include <dirent.h>    /* Defines DT_* constants */
 #include <fcntl.h>
 #include <stdio.h>
@@ -1434,7 +1433,7 @@ static int __msc_compare_with_db(void **handle, const char *storage_id, const ch
        ret = ms_get_folder_list(handle, storage_id, start_path, dir_array);
        if (ret != MS_MEDIA_ERR_NONE) {
                MS_SAFE_FREE(start_path);
-               MS_DBG_ERR("ms_get_folder_list is failed", ret);
+               MS_DBG_ERR("ms_get_folder_list is failed [%d]", ret);
                return ret;
        }
 
@@ -1576,7 +1575,7 @@ gboolean msc_storage_scan_thread(void *data)
        int ret;
        int err;
        void **handle = NULL;
-       ms_user_storage_type_t storage_type = MS_STORAGE_INTERNAL;
+       ms_user_storage_type_t storage_type = MS_USER_STORAGE_INTERNAL;
        int scan_type;
        bool valid_status = TRUE;
        char *update_path = NULL;
@@ -1645,7 +1644,7 @@ gboolean msc_storage_scan_thread(void *data)
                if (scan_type != MS_MSG_STORAGE_INVALID)
                        ms_bacth_commit_enable(handle, TRUE, valid_status, MS_NOTI_SWITCH_OFF, 0);
 
-               if (scan_type == MS_MSG_STORAGE_PARTIAL && storage_type == MS_STORAGE_INTERNAL) {
+               if (scan_type == MS_MSG_STORAGE_PARTIAL && storage_type == MS_USER_STORAGE_INTERNAL) {
                        ms_validaty_change_all_items(handle, scan_data->storage_id, storage_type, true, uid);
 
                        /* find and compare modified time */
index 5b68bcf..460301a 100755 (executable)
@@ -715,7 +715,7 @@ static int __msc_compare_with_db(void **handle, const char *storage_id, const ch
        ret = ms_get_folder_list(handle, storage_id, start_path, dir_array);
        if (ret != MS_MEDIA_ERR_NONE) {
                MS_SAFE_FREE(start_path);
-               MS_DBG_ERR("ms_get_folder_list is failed", ret);
+               MS_DBG_ERR("ms_get_folder_list is failed [%d]", ret);
                return ret;
        }
 
@@ -833,7 +833,7 @@ gboolean msc_storage_scan_thread(void *data)
        int ret;
        int err;
        void **handle = NULL;
-       ms_user_storage_type_t storage_type = MS_STORAGE_INTERNAL;
+       ms_user_storage_type_t storage_type = MS_USER_STORAGE_INTERNAL;
        int scan_type;
        bool valid_status = TRUE;
        char *update_path = NULL;
@@ -898,7 +898,7 @@ gboolean msc_storage_scan_thread(void *data)
                valid_status = (scan_type == MS_MSG_STORAGE_PARTIAL) ? TRUE : FALSE;
                ms_bacth_commit_enable(handle, TRUE, valid_status, MS_NOTI_SWITCH_OFF, 0);
 
-               if (scan_type == MS_MSG_STORAGE_PARTIAL && storage_type == MS_STORAGE_INTERNAL) {
+               if (scan_type == MS_MSG_STORAGE_PARTIAL && storage_type == MS_USER_STORAGE_INTERNAL) {
                        ms_validaty_change_all_items(handle, storage_id, storage_type, true, scan_data->uid);
 
                        /* find and compare modified time */
@@ -922,7 +922,7 @@ gboolean msc_storage_scan_thread(void *data)
                                        MS_DBG_ERR("msc_delete_all_record fails");
                                }
 
-                               if (storage_type == MS_STORAGE_EXTERNAL) {
+                               if (storage_type == MS_USER_STORAGE_EXTERNAL) {
                                        /*storage info updated in media-server*/
                                        /*ms_update_mmc_info();*/
                                }
index 3dabe0f..d371bc8 100755 (executable)
@@ -18,7 +18,6 @@
  * limitations under the License.
  *
  */
-#define _GNU_SOURCE
 
 #include <dirent.h>
 #include <errno.h>
index 2ba73b2..79f3c79 100755 (executable)
@@ -18,7 +18,7 @@
  * limitations under the License.
  *
  */
-#define _GNU_SOURCE
+
 #include <arpa/inet.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -432,10 +432,10 @@ int ms_send_scan_request(ms_comm_msg_s *send_msg, int client_sock)
                if (err == MS_MEDIA_ERR_NONE) {
                        err = __ms_send_request(send_msg);
                        if (err != MS_MEDIA_ERR_NONE) {
-                               MS_DBG_ERR("__ms_send_request failed", err);
+                               MS_DBG_ERR("__ms_send_request failed [%d]", err);
                        }
                } else {
-                       MS_DBG_ERR("Scanner starting failed. %d", err);
+                       MS_DBG_ERR("Scanner starting failed [%d]", err);
                        res = err;
                }
        }
@@ -828,7 +828,7 @@ ERROR:
                int send_msg = MS_MEDIA_ERR_NONE;
 
                if (error != NULL) {
-                       MS_DBG_SLOG("g_thread_pool_push failed [%d]", error->message);
+                       MS_DBG_SLOG("g_thread_pool_push failed [%s]", error->message);
                        g_error_free(error);
                        error = NULL;
                }
index 26cbe09..2f589fc 100755 (executable)
@@ -18,7 +18,6 @@
  * limitations under the License.
  *
  */
-#define _GNU_SOURCE
 
 #include <dirent.h>
 #include <errno.h>