Update to change strerror_r to guaranteee of thread safety 07/157007/3
authorYoungHun Kim <yh8004.kim@samsung.com>
Mon, 23 Oct 2017 06:14:13 +0000 (15:14 +0900)
committerYoungHun Kim <yh8004.kim@samsung.com>
Mon, 23 Oct 2017 06:29:55 +0000 (15:29 +0900)
Change-Id: Ic64eb3db5f9784b2ef5ef00ed8c066d42faa1c2c

packaging/mused.spec
server/src/muse_server_tool.c

index 8e3077e..b8a533b 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mused
 Summary:    A multimedia daemon
-Version:    0.3.12
+Version:    0.3.13
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index 443d3ad..90907ef 100644 (file)
@@ -192,10 +192,11 @@ static int _ms_connection_register(int fd, gpointer user_data)
        event.data.ptr = GINT_TO_POINTER(connection->fd);
 
        if (epoll_ctl(ms_tool->event_h->epfd, EPOLL_CTL_ADD, connection->fd, &event) == MUSE_ERR) {
-               snprintf(err_msg, MUSE_MAX_MSG_LEN, "epoll_ctl in activate failed %s", strerror(errno));
+               strerror_r(errno, err_msg, MUSE_MAX_MSG_LEN);
+               LOGE("%s", err_msg);
+
                g_mutex_unlock(&ms_tool->diag_lock);
                free(connection);
-               LOGE("%s", err_msg);
                return MM_ERROR_UNKNOWN;
        }
 
@@ -221,9 +222,9 @@ static int _ms_connection_unregister(int fd)
 
        connection = (ms_connection_t *)g_hash_table_lookup(ms_tool->event_h->fd_table, GINT_TO_POINTER(fd));
        if (connection && epoll_ctl(ms_tool->event_h->epfd, EPOLL_CTL_DEL, connection->fd, NULL) == MUSE_ERR) {
-               snprintf(err_msg, MUSE_MAX_MSG_LEN, "epoll_ctl in deactivate failed %s", strerror(errno));
-               MUSE_FREE(connection);
+               strerror_r(errno, err_msg, MUSE_MAX_MSG_LEN);
                LOGE("%s", err_msg);
+               MUSE_FREE(connection);
                return MM_ERROR_UNKNOWN;
        }
 
@@ -251,7 +252,7 @@ static ms_event_e _ms_connection_handle_event(int *value)
 
        if (fd_count < 0) {
                if (errno != EINTR) {
-                       snprintf(err_msg, MUSE_MAX_MSG_LEN, "epoll_wait() failed %s", strerror(errno));
+                       strerror_r(errno, err_msg, MUSE_MAX_MSG_LEN);
                        LOGE("%s", err_msg);
                }
                return MUSE_EVENT_UNKNOWN;