Updated error reporting for sock_fd_read()

This commit is contained in:
Joseph Henry 2016-01-12 14:25:30 -08:00
parent 7991a7c50a
commit bdabe40c65
2 changed files with 3 additions and 7 deletions

View file

@ -238,7 +238,7 @@ int connect(CONNECT_SIG)
struct sockaddr_storage storage;
memcpy(&storage, __addr, __len);
struct sockaddr_un *s_un = (struct sockaddr_un*)&storage;
fprintf(stderr, "connect(): address = %s\n", s_un->sun_path);
dwr(MSG_DEBUG, "connect(): address = %s\n", s_un->sun_path);
}
int port = connaddr->sin_port;

View file

@ -43,10 +43,8 @@ int get_new_fd(int sock)
char buf[BUF_SZ];
int newfd;
ssize_t size = sock_fd_read(sock, buf, sizeof(buf), &newfd);
if(size > 0){
if(size > 0)
return newfd;
}
fprintf(stderr, "get_new_fd(): Error, unable to read fd over (%d)\n", sock);
return -1;
}
@ -254,10 +252,8 @@ ssize_t sock_fd_read(int sock, void *buf, ssize_t bufsize, int *fd)
msg.msg_control = cmsgu.control;
msg.msg_controllen = sizeof(cmsgu.control);
size = recvmsg (sock, &msg, 0);
if (size < 0) {
fprintf(stderr, "sock_fd_read(): recvmsg: Error\n");
if (size < 0)
return -1;
}
cmsg = CMSG_FIRSTHDR(&msg);
if (cmsg && cmsg->cmsg_len == CMSG_LEN(sizeof(int))) {
if (cmsg->cmsg_level != SOL_SOCKET) {