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;
}
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;
}
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;