_cmd[strlen(_cmd)] = '\0';
if (write(client_sock, _cmd, strlen(_cmd) + 1) != ((int)(strlen(_cmd) + 1))) {
- scmirroring_error("sendto failed [%s]", strerror(errno));
+ char buf[255] = {0, };
+ strerror_r(errno, buf, sizeof(buf));
+ scmirroring_error("sendto failed [%s]", buf);
ret = SCMIRRORING_ERROR_INVALID_OPERATION;
} else {
scmirroring_debug("Sent response [%s] successfully", _cmd);
int i;
gboolean bind_success = FALSE;
struct sockaddr_un serv_addr;
+ char buf[255] = {0, };
/* Create a TCP socket */
if ((sock = socket(PF_FILE, SOCK_STREAM, 0)) < 0) {
- scmirroring_error("socket failed: %s", strerror(errno));
+ strerror_r(errno, buf, sizeof(buf));
+ scmirroring_error("socket failed: %s", buf);
return FALSE;
}
}
if (bind_success == false) {
- scmirroring_error("bind failed : %s %d_", strerror(errno), errno);
+ strerror_r(errno, buf, sizeof(buf));
+ scmirroring_error("bind failed : %s %d_", buf, errno);
close(sock);
return FALSE;
}
/* Listening */
if (listen(sock, SOMAXCONN) < 0) {
- scmirroring_error("listen failed : %s", strerror(errno));
+ strerror_r(errno, buf, sizeof(buf));
+ scmirroring_error("listen failed : %s", buf);
close(sock);
return FALSE;
}
/*change permission of sock file*/
- if (chmod(MEDIA_IPC_PATH, 0770) < 0)
- scmirroring_error("chmod failed [%s]", strerror(errno));
- if (chown(MEDIA_IPC_PATH, 200, 5000) < 0)
- scmirroring_error("chown failed [%s]", strerror(errno));
+ if (chmod(MEDIA_IPC_PATH, 0770) < 0) {
+ strerror_r(errno, buf, sizeof(buf));
+ scmirroring_error("chmod failed [%s]", buf);
+ }
+ if (chown(MEDIA_IPC_PATH, 200, 5000) < 0) {
+ strerror_r(errno, buf, sizeof(buf));
+ scmirroring_error("chown failed [%s]", buf);
+ }
scmirroring_debug("Listening...");
*sockfd = sock;
client_addr_len = sizeof(client_addr);
if ((sockfd = accept(serv_sock, (struct sockaddr *)&client_addr, &client_addr_len)) < 0) {
- scmirroring_error("accept failed : %s", strerror(errno));
+ char buf[255] = {0, };
+ strerror_r(errno, buf, sizeof(buf));
+ scmirroring_error("accept failed : %s", buf);
*client_sock = -1;
return SCMIRRORING_ERROR_INVALID_OPERATION;
}
GIOChannel *channel = NULL;
channel = g_io_channel_unix_new(client_sock);
if (channel == NULL) {
- scmirroring_error("g_io_channel_unix_new failed: %s", strerror(errno));
+ char buf[255] = {0, };
+ strerror_r(errno, buf, sizeof(buf));
+ scmirroring_error("g_io_channel_unix_new failed: %s", buf);
}
/* Create new channel to watch udp socket */
_cmd[strlen(_cmd)] = '\0';
if (write(scmirroring->sock, _cmd, strlen(_cmd) + 1) != (signed int) strlen(_cmd) + 1) {
- scmirroring_error("sendto failed [%s]", strerror(errno));
+ char buf[255] = {0, };
+ strerror_r(errno, buf, sizeof(buf));
+ scmirroring_error("sendto failed [%s]", buf);
ret = SCMIRRORING_ERROR_INVALID_OPERATION;
} else {
scmirroring_debug("Sent message [%s] successfully", _cmd);
int sock = -1;
GIOChannel *channel = NULL;
struct timeval tv_timeout = { TIMEOUT_SEC, 0 };
+ char buf[255] = {0, };
scmirroring_src_s *_scmirroring = (scmirroring_src_s *)scmirroring;
/*Create TCP Socket*/
if ((sock = socket(PF_FILE, SOCK_STREAM, 0)) < 0) {
- scmirroring_error("socket failed: %s", strerror(errno));
+ strerror_r(errno, buf, sizeof(buf));
+ scmirroring_error("socket failed: %s", buf);
return SCMIRRORING_ERROR_INVALID_OPERATION;
}
if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &tv_timeout, sizeof(tv_timeout)) == -1) {
- scmirroring_error("setsockopt failed: %s", strerror(errno));
+ strerror_r(errno, buf, sizeof(buf));
+ scmirroring_error("setsockopt failed: %s", buf);
close(sock);
return SCMIRRORING_ERROR_INVALID_OPERATION;
}
channel = g_io_channel_unix_new(sock);
if (channel == NULL) {
- scmirroring_error("g_io_channel_unix_new failed: %s", strerror(errno));
+ strerror_r(errno, buf, sizeof(buf));
+ scmirroring_error("g_io_channel_unix_new failed: %s", buf);
}
g_io_channel_set_flags(channel, G_IO_FLAG_NONBLOCK, NULL);
goto try;
}
- scmirroring_error("Connect error : %s", strerror(errno));
+ strerror_r(errno, buf, sizeof(buf));
+ scmirroring_error("Connect error : %s", buf);
close(_scmirroring->sock);
_scmirroring->sock = -1;
return SCMIRRORING_ERROR_INVALID_OPERATION;