Fix the VD Svace issue for TRACE_STRERROR 86/85386/1
authorHyeKyoung Hwang <cookie@samsung.com>
Thu, 25 Aug 2016 01:46:03 +0000 (10:46 +0900)
committerHyeKyoung Hwang <cookie@samsung.com>
Thu, 25 Aug 2016 01:46:03 +0000 (10:46 +0900)
Change-Id: I9dc361be23a1558903a3ce504272ad767cc675bc
Signed-off-by: HyeKyoung Hwang <cookie@samsung.com>
bookmark-adaptor/bookmark-adaptor.c
common-adaptor/common-adaptor.c
history-adaptor/history-adaptor.c
provider/browser-provider-db.c [changed mode: 0644->0755]
provider/browser-provider-main.c
provider/browser-provider-notify.c [changed mode: 0644->0755]
provider/browser-provider-requests-manager.c
provider/browser-provider-requests.c
provider/browser-provider-socket.c
provider/include/browser-provider-log.h
tab-adaptor/tab-adaptor.c

index 1e4039742a38fbaf361b70b0a67c64b4fc34f963..97792ec9f57454b8ba20e0832611a43db1758823 100755 (executable)
@@ -100,7 +100,7 @@ int __browser_adaptor_connect(int callback)
                // create thread here ( getting event_socket )
                if (pthread_create(&g_adaptor_event_thread_pid, NULL,
                                __bookmark_adaptor_event_manager, g_adaptorinfo) != 0) {
-                       TRACE_STRERROR("[CRITICAL] pthread_create");
+                       TRACE_ERROR("[CRITICAL] pthread_create");
                        return -1;
                }
                pthread_detach(g_adaptor_event_thread_pid);
index 380689d92d2ac4759f85f54d5721ff22a54bed48..05c0262ea9093c1a7f9310eb8236b82e33544f68 100755 (executable)
@@ -47,7 +47,7 @@ static int __adaptor_create_socket()
        struct timeval tv_timeo = { 3, 500000 }; //3.5 second
        if (setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &tv_timeo,
                        sizeof( tv_timeo ) ) < 0) {
-               TRACE_STRERROR("[CRITICAL] setsockopt SO_RCVTIMEO");
+               TRACE_ERROR("[CRITICAL] setsockopt SO_RCVTIMEO");
                close(sockfd);
                return -1;
        }
@@ -157,7 +157,7 @@ int bp_common_adaptor_connect_to_provider(bp_adaptor_defs **adaptorinfo,
                        ipcinfo->cmd_socket = __adaptor_create_socket();
                }
                if (ipcinfo->cmd_socket < 0) {
-                       TRACE_STRERROR("[CRITICAL] connect system error");
+                       TRACE_ERROR("[CRITICAL] connect system error");
                        free(ipcinfo);
                        ipcinfo = NULL;
                        return -1;
@@ -218,7 +218,7 @@ int bp_adaptor_ipc_read_int(int fd)
        int value = -1;
        ssize_t recv_bytes = read(fd, &value, sizeof(int));
        if (recv_bytes < 0) {
-               TRACE_STRERROR("[CRITICAL] read");
+               TRACE_ERROR("[CRITICAL] read");
                return -1;
        }
        return value;
@@ -249,7 +249,7 @@ int bp_common_adaptor_get_ids_p(const int sock, bp_command_fmt *cmd,
        if (ids_count > 0) {
                idlist = (int *)calloc(ids_count, sizeof(int));
                if (idlist == NULL) {
-                       TRACE_STRERROR("[CRITICAL] allocation");
+                       TRACE_ERROR("[CRITICAL] allocation");
                        *errorcode = BP_ERROR_OUT_OF_MEMORY;
                        BP_PRINT_ERROR(cmd->id, *errorcode);
                        return -1;
@@ -706,19 +706,19 @@ static char *__get_cmdline()
 
        ret = snprintf(proc_path, buf_size, "/proc/%d/cmdline", getpid());
        if (ret < 0) {
-               TRACE_STRERROR("failed to make cmdline path");
+               TRACE_ERROR("failed to make cmdline path");
                return NULL;
        }
 
        fd = open(proc_path, O_RDONLY, 0600);
        if (fd < 0) {
-               TRACE_STRERROR("open cmdline:%s", proc_path);
+               TRACE_ERROR("open cmdline:%s", proc_path);
                return NULL;
        }
        ret = read(fd, proc_path, buf_size - 1);
        close(fd);
        if (ret <= 0) {
-               TRACE_STRERROR("read cmdline:%s", proc_path);
+               TRACE_ERROR("read cmdline:%s", proc_path);
                return NULL;
        }
        proc_path[ret] = 0;
@@ -763,7 +763,7 @@ int bp_common_adaptor_disconnect(bp_adaptor_defs **info, pthread_t *tid)
 {
        if (tid != NULL && (*tid > 0 && pthread_kill(*tid, 0) != ESRCH)) {
                if (pthread_cancel(*tid) != 0) {
-                       TRACE_STRERROR("pthread:%0x", (int)*tid);
+                       TRACE_ERROR("pthread:%0x", (int)*tid);
                }
                *tid = 0;
        }
@@ -782,7 +782,7 @@ int bp_common_adaptor_clear_read_buffer(int sock, size_t length)
        TRACE_DEBUG("[CLEAN] garbage packet[%ld]", length);
        for (i = 0; i < length; i++) {
                if (read(sock, &tmp_char, sizeof(char)) < 0) {
-                       TRACE_STRERROR("[CHECK] read");
+                       TRACE_ERROR("[CHECK] read");
                        return -1;
                }
        }
@@ -804,7 +804,7 @@ int bp_common_adaptor_event_manager(bp_adaptor_defs *adaptorinfo,
        TRACE_DEBUG("IPC ESTABILISH %s", notify_fifo);
        adaptorinfo->notify = open(notify_fifo, O_RDONLY, 0600);
        if (adaptorinfo->notify < 0) {
-               TRACE_STRERROR("failed to ESTABILISH IPC %s", notify_fifo);
+               TRACE_ERROR("failed to ESTABILISH IPC %s", notify_fifo);
                return -1;
        }
 
index 069beee190dd387afb1b30da476943189932ed78..0f966a0887ed0612aca81f86408dcf791192b61d 100755 (executable)
@@ -93,7 +93,7 @@ static int __browser_adaptor_connect(int callback)
                // create thread here ( getting event_socket )
                if (pthread_create(&g_adaptor_event_thread_pid, NULL,
                                __history_adaptor_event_manager, g_adaptorinfo) != 0) {
-                       TRACE_STRERROR("[CRITICAL] pthread_create");
+                       TRACE_ERROR("[CRITICAL] pthread_create");
                        return -1;
                }
                pthread_detach(g_adaptor_event_thread_pid);
old mode 100644 (file)
new mode 100755 (executable)
index 3fe9406..6303135
@@ -1962,7 +1962,7 @@ char *bp_db_get_text_stmt(sqlite3_stmt* stmt, int index)
                                getbytes * sizeof(char));
                        getstr[getbytes] = '\0';
                } else {
-                       TRACE_STRERROR("[CHECK] alloc for string");
+                       TRACE_ERROR("[CHECK] alloc for string");
                }
        }
        return getstr;
index 051d0930dcbf59796e5a3714768886e9d1d3d387..5d5ad4baf0c81065e9984e703226805d929520de 100755 (executable)
@@ -84,13 +84,13 @@ static void on_changed_receive(void *data, DBusMessage *msg)
        }
        pid_t child_pid = 0;
        if((child_pid = fork()) < 0 ) {
-               TRACE_STRERROR("[ERROR] fock");
+               TRACE_ERROR("[ERROR] fock");
        } else {
                if(child_pid == 0) {
                        execl(tzplatform_mkpath(TZ_SYS_RO_APPS, "org.tizen.browser/bin/browser"),
                                tzplatform_mkpath(TZ_SYS_RO_APPS, "org.tizen.browser/bin/browser"),
                                "precaching", NULL);
-                       TRACE_STRERROR("[ERROR] execl browser precaching");
+                       TRACE_ERROR("[ERROR] execl browser precaching");
                        exit(EXIT_SUCCESS);
                }
        }
old mode 100644 (file)
new mode 100755 (executable)
index 1750bb7..93c36bf
@@ -28,11 +28,11 @@ static char *__bp_notify_get_path(int pid)
        size_t path_size = sizeof(NOTIFY_DIR) + 21;
        char *notify_fifo = (char *)calloc(path_size, sizeof(char));
        if (notify_fifo == NULL) {
-               TRACE_STRERROR("failed to alocalte fifo path pid:%d", (int)pid);
+               TRACE_ERROR("failed to alocalte fifo path pid:%d", (int)pid);
                return NULL;
        }
        if (snprintf(notify_fifo, path_size,"%s/%d", NOTIFY_DIR, pid) < 0) {
-               TRACE_STRERROR("failed to make fifo path pid:%d", (int)pid);
+               TRACE_ERROR("failed to make fifo path pid:%d", (int)pid);
                free(notify_fifo);
                return NULL;
        }
@@ -49,7 +49,7 @@ int bp_notify_init(int pid)
        if (stat(notify_fifo, &fifo_state) == 0) // found
                unlink(notify_fifo);
        if (mkfifo(notify_fifo, 0644/*-rwrr*/) < 0) {
-               TRACE_STRERROR("failed to make fifo %s", notify_fifo);
+               TRACE_ERROR("failed to make fifo %s", notify_fifo);
        } else {
                notify_fd = open(notify_fifo, O_RDWR | O_NONBLOCK, 0600);
        }
index 838bb397dad533fca21c416b9e5e2e01719f99f0..f81f55311d2bbd0fa7dbe099cb8e9c69c2b3abd9 100755 (executable)
@@ -552,7 +552,7 @@ void bp_thread_requests_manager(bp_privates_defs *privates)
                eset = except_fdset;
 
                if (select((maxfd + 1), &rset, 0, &eset, &timeout) < 0) {
-                       TRACE_STRERROR("[CRITICAL] select");
+                       TRACE_ERROR("[CRITICAL] select");
                        break;
                }
 
@@ -587,7 +587,7 @@ void bp_thread_requests_manager(bp_privates_defs *privates)
                        tv_timeo.tv_usec = 500000;
                        if (setsockopt(clientfd, SOL_SOCKET, SO_RCVTIMEO, &tv_timeo,
                                sizeof( tv_timeo ) ) < 0) {
-                               TRACE_STRERROR("[CRITICAL] setsockopt SO_SNDTIMEO");
+                               TRACE_ERROR("[CRITICAL] setsockopt SO_SNDTIMEO");
                                close(clientfd);
                                continue;
                        }
@@ -671,7 +671,7 @@ void bp_thread_requests_manager(bp_privates_defs *privates)
                                        (bp_client_defs *)calloc(1,
                                        sizeof(bp_client_defs));
                                if (privates->slots[i].client == NULL) {
-                                       TRACE_STRERROR("calloc, ignore this client");
+                                       TRACE_ERROR("calloc, ignore this client");
                                        bp_ipc_send_errorcode(clientfd,
                                                BP_ERROR_OUT_OF_MEMORY);
                                        close(clientfd);
@@ -789,7 +789,7 @@ void bp_thread_requests_manager(bp_privates_defs *privates)
                                // make notify fifo
                                privates->slots[i].client->notify = bp_notify_init(cid);
                                if (privates->slots[i].client->notify < 0) {
-                                       TRACE_STRERROR("failed to open fifo slot:%d", clientfd);
+                                       TRACE_ERROR("failed to open fifo slot:%d", clientfd);
                                        bp_ipc_send_errorcode(clientfd, BP_ERROR_IO_ERROR);
                                        bp_client_free(privates->slots[i].client);
                                        privates->slots[i].client = NULL;
@@ -871,7 +871,7 @@ void bp_thread_requests_manager(bp_privates_defs *privates)
                                                BP_CARE_CLIENT_MIN_INTERVAL) {
                                        // this is error.
                                        // terminate Process
-                                       TRACE_STRERROR
+                                       TRACE_ERROR
                                        ("[CRITICAL] Sock exception prev[%ld]now[%ld][%ld]",
                                        prev_timeout, now_timeout, flexible_timeout);
                                        break;
index 31d5a6d77eb6e5aaf09663da553756f76a213458..7051203f9e8088c608b10a692bb0fcb3c53a1c4c 100755 (executable)
@@ -1241,7 +1241,7 @@ bp_error_defs bp_common_get_inquired_ids(sqlite3 *handle,
                        BP_DB_COMMON_COL_IS_DELETED, cond2);
        }
        if (basic_cond == NULL) {
-               TRACE_STRERROR("[ERROR] make query");
+               TRACE_ERROR("[ERROR] make query");
                return BP_ERROR_OUT_OF_MEMORY;
        }
        if (is_like > 0) {
@@ -1284,7 +1284,7 @@ bp_error_defs bp_common_get_inquired_ids(sqlite3 *handle,
        }
        sqlite3_free(basic_cond);
        if (conditions == NULL) {
-               TRACE_STRERROR("[ERROR] make query");
+               TRACE_ERROR("[ERROR] make query");
                return BP_ERROR_OUT_OF_MEMORY;
        }
 
@@ -1308,7 +1308,7 @@ bp_error_defs bp_common_get_inquired_ids(sqlite3 *handle,
        if (limit > 0 && errorcode == BP_ERROR_NONE) {
                inquired_ids = (int *)calloc(limit, sizeof(int));
                if (inquired_ids == NULL) {
-                       TRACE_STRERROR("[ERROR] allocation:%d", limit);
+                       TRACE_ERROR("[ERROR] allocation:%d", limit);
                        errorcode = BP_ERROR_OUT_OF_MEMORY;
                } else {
                        inquired_ids_count = bp_db_get_custom_bind_conds_ids(handle,
@@ -1356,7 +1356,7 @@ bp_error_defs bp_common_get_duplicated_url_ids(sqlite3 *handle,
                        BP_DB_COMMON_COL_IS_DELETED, cond2);
        }
        if (basic_cond == NULL) {
-               TRACE_STRERROR("[ERROR] make query");
+               TRACE_ERROR("[ERROR] make query");
                return BP_ERROR_OUT_OF_MEMORY;
        }
        if (is_like > 0) {
@@ -1384,7 +1384,7 @@ bp_error_defs bp_common_get_duplicated_url_ids(sqlite3 *handle,
        }
        sqlite3_free(basic_cond);
        if (conditions == NULL) {
-               TRACE_STRERROR("[ERROR] make query");
+               TRACE_ERROR("[ERROR] make query");
                return BP_ERROR_OUT_OF_MEMORY;
        }
 
@@ -1409,7 +1409,7 @@ bp_error_defs bp_common_get_duplicated_url_ids(sqlite3 *handle,
        if (limit > 0 && errorcode == BP_ERROR_NONE) {
                inquired_ids = (int *)calloc(limit, sizeof(int));
                if (inquired_ids == NULL) {
-                       TRACE_STRERROR("[ERROR] allocation:%d", limit);
+                       TRACE_ERROR("[ERROR] allocation:%d", limit);
                        errorcode = BP_ERROR_OUT_OF_MEMORY;
                } else {
                        inquired_ids_count = bp_db_get_custom_bind_conds_ids(handle,
@@ -1457,7 +1457,7 @@ bp_error_defs bp_common_get_duplicated_ids(sqlite3 *handle,
                        BP_DB_COMMON_COL_IS_DELETED, cond2);
        }
        if (basic_cond == NULL) {
-               TRACE_STRERROR("[ERROR] make query");
+               TRACE_ERROR("[ERROR] make query");
                return BP_ERROR_OUT_OF_MEMORY;
        }
        if (is_like > 0) {
@@ -1470,7 +1470,7 @@ bp_error_defs bp_common_get_duplicated_ids(sqlite3 *handle,
        }
        sqlite3_free(basic_cond);
        if (conditions == NULL) {
-               TRACE_STRERROR("[ERROR] make query");
+               TRACE_ERROR("[ERROR] make query");
                return BP_ERROR_OUT_OF_MEMORY;
        }
 
@@ -1494,7 +1494,7 @@ bp_error_defs bp_common_get_duplicated_ids(sqlite3 *handle,
        if (limit > 0 && errorcode == BP_ERROR_NONE) {
                inquired_ids = (int *)calloc(limit, sizeof(int));
                if (inquired_ids == NULL) {
-                       TRACE_STRERROR("[ERROR] allocation:%d", limit);
+                       TRACE_ERROR("[ERROR] allocation:%d", limit);
                        errorcode = BP_ERROR_OUT_OF_MEMORY;
                } else {
                        inquired_ids_count = bp_db_get_custom_bind_conds_ids(handle,
@@ -1544,7 +1544,7 @@ bp_error_defs bp_common_get_ids(sqlite3 *handle,
 
        inquired_ids = (int *)calloc(limit, sizeof(int));
        if (inquired_ids == NULL) {
-               TRACE_STRERROR("[ERROR] allocation:%d", limit);
+               TRACE_ERROR("[ERROR] allocation:%d", limit);
                return BP_ERROR_OUT_OF_MEMORY;
        }
 
@@ -1642,7 +1642,7 @@ void bp_rebuild_dir(const char *dirpath)
                                TRACE_SECURE_ERROR("failed to set smack label:%s", dirpath);
                        }
                } else {
-                       TRACE_STRERROR("failed to create directory:%s", dirpath);
+                       TRACE_ERROR("failed to create directory:%s", dirpath);
                }
        }
 }
index d4f6c5ef875c95bab4cd42131fea98639cae1ffd..d1c9b9aee8df3e7be3687117ba5f5cf3808fedac 100755 (executable)
@@ -72,7 +72,7 @@ int bp_ipc_send_errorcode(int fd, bp_error_defs errorcode)
        }
 
        if (fd < 0 || write(fd, &errorcode, sizeof(bp_error_defs)) <= 0) {
-               TRACE_STRERROR("[IPC.Write] exception sock:%d", fd);
+               TRACE_ERROR("[IPC.Write] exception sock:%d", fd);
                return -1;
        }
        return 0;
@@ -112,7 +112,7 @@ int bp_ipc_send_command(int fd, bp_command_fmt *cmd)
        }
 
        if (fd < 0 || write(fd, cmd, sizeof(bp_command_fmt)) < 0) {
-               TRACE_STRERROR("[IPC.Write] exception sock:%d", fd);
+               TRACE_ERROR("[IPC.Write] exception sock:%d", fd);
                return -1;
        }
        return 0;
@@ -141,7 +141,7 @@ char *bp_ipc_read_string(int fd)
        }
        str = (char *)calloc((length + 1), sizeof(char));
        if (str == NULL) {
-               TRACE_STRERROR("[ERROR] calloc length:%d sock:%d", length, fd);
+               TRACE_ERROR("[ERROR] calloc length:%d sock:%d", length, fd);
                return NULL;
        }
        remain_size = length;
@@ -165,7 +165,7 @@ char *bp_ipc_read_string(int fd)
                free(str);
                return NULL;
        } else if (recv_size < 0) {
-               TRACE_STRERROR("[IPC.Read] exception sock:%d", fd);
+               TRACE_ERROR("[IPC.Read] exception sock:%d", fd);
                free(str);
                return NULL;
        }
@@ -194,7 +194,7 @@ int bp_ipc_send_string(int fd, const char *str)
        }
        if (fd < 0 || write(fd, &length, sizeof(unsigned)) <= 0 ||
                        write(fd, str, length * sizeof(char)) <= 0) {
-               TRACE_STRERROR("[IPC.Write] exception sock:%d", fd);
+               TRACE_ERROR("[IPC.Write] exception sock:%d", fd);
                return -1;
        }
        return 0;
@@ -211,7 +211,7 @@ int bp_ipc_send_custom_type(int fd, void *value, size_t type_size)
                return -1;
        }
        if (fd < 0 || write(fd, value, type_size) <= 0) {
-               TRACE_STRERROR("[IPC.Write] exception sock:%d", fd);
+               TRACE_ERROR("[IPC.Write] exception sock:%d", fd);
                return -1;
        }
        return 0;
@@ -259,7 +259,7 @@ int bp_ipc_read_blob(int fd, void *value, size_t type_size)
                TRACE_ERROR("[ERROR] closed peer sock:%d", fd);
                return -1;
        } else if (recv_size < 0) {
-               TRACE_STRERROR("[IPC.Read] exception sock:%d", fd);
+               TRACE_ERROR("[IPC.Read] exception sock:%d", fd);
                return -1;
        }
        return 0;
@@ -277,16 +277,16 @@ bp_error_defs bp_ipc_check_stderr(bp_error_defs basecode)
 {
        bp_error_defs errorcode = basecode;
        if (errno == EPIPE) {
-               TRACE_STRERROR("[EPIPE:%d] Broken Pipe", errno);
+               TRACE_ERROR("[EPIPE:%d] Broken Pipe", errno);
                errorcode = BP_ERROR_IO_ERROR;
        } else if (errno == EAGAIN) {
-               TRACE_STRERROR("[EAGAIN:%d]", errno);
+               TRACE_ERROR("[EAGAIN:%d]", errno);
                errorcode = BP_ERROR_IO_EAGAIN;
        } else if (errno == EINTR) {
-               TRACE_STRERROR("[EINTR:%d]", errno);
+               TRACE_ERROR("[EINTR:%d]", errno);
                errorcode = BP_ERROR_IO_EINTR;
        } else {
-               TRACE_STRERROR("[errno:%d]", errno);
+               TRACE_ERROR("[errno:%d]", errno);
        }
        return errorcode;
 }
index e2922e497f9fd2fcaabd1fb8e69c964bf4b764a1..80cd7b115f14496891f191223e154da591a9d06b 100755 (executable)
@@ -40,7 +40,6 @@ static inline void bp_ftrace(char *fmt, ...)
 }
 #define TRACE_DEBUG(format, ARG...) bp_ftrace("[%s][%s:%d] "format"\n", LOG_TAG, __FUNCTION__, __LINE__, ##ARG)
 #define TRACE_ERROR(format, ARG...) bp_ftrace("[%s][%s:%d] "format" [%s]\n", LOG_TAG, __FUNCTION__, __LINE__, ##ARG, strerror(errno))
-#define TRACE_STRERROR(format, ARG...) bp_ftrace("[%s][%s:%d] "format"\n", LOG_TAG, __FUNCTION__, __LINE__, ##ARG)
 #define TRACE_INFO(format, ARG...) bp_ftrace("[%s][%s:%d] "format"\n", LOG_TAG, __FUNCTION__, __LINE__, ##ARG)
 #define TRACE_WARN(format, ARG...) bp_ftrace("[%s][%s:%d] "format"\n", LOG_TAG, __FUNCTION__, __LINE__, ##ARG)
 #define TRACE_SECURE_DEBUG(format, ARG...) bp_ftrace("[%s][%s:%d] "format"\n", LOG_TAG, __FUNCTION__, __LINE__, ##ARG)
@@ -61,7 +60,6 @@ static inline void bp_ftrace(char *fmt, ...)
 #define TRACE_DEBUG(...) do { } while(0)
 #endif
 #define TRACE_ERROR(format, ARG...) LOGE(format, ##ARG)
-#define TRACE_STRERROR(format, ARG...) LOGE(format" [%s]", ##ARG, strerror(errno))
 #define TRACE_INFO(format, ARG...) LOGI(format, ##ARG)
 #define TRACE_WARN(format, ARG...) LOGW(format, ##ARG)
 
@@ -87,7 +85,6 @@ static inline void bp_ftrace(char *fmt, ...)
 
 #define TRACE_DEBUG(...) do { } while(0)
 #define TRACE_ERROR(...) do { } while(0)
-#define TRACE_STRERROR(...) do { } while(0)
 #define TRACE_INFO(...) do { } while(0)
 #define TRACE_WARN(...) do { } while(0)
 #define TRACE_SECURE_DEBUG(...) do { } while(0)
index 62bb184d04d3062b146ddcffbb9f9c9413ee8e04..928f225ad671b96d28d5ad73247bf1fba028047b 100755 (executable)
@@ -98,7 +98,7 @@ static int __browser_adaptor_connect(int callback)
                // create thread here ( getting event_socket )
                if (pthread_create(&g_adaptor_event_thread_pid, NULL,
                                __tab_adaptor_event_manager, g_adaptorinfo) != 0) {
-                       TRACE_STRERROR("[CRITICAL] pthread_create");
+                       TRACE_ERROR("[CRITICAL] pthread_create");
                        return -1;
                }
                pthread_detach(g_adaptor_event_thread_pid);