From bdabe40c65fd2205140902c0a62dfea2ab92fced Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Tue, 12 Jan 2016 14:25:30 -0800 Subject: Updated error reporting for sock_fd_read() --- netcon/Intercept.c | 2 +- netcon/RPC.c | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/netcon/Intercept.c b/netcon/Intercept.c index c6868b8e..40c90957 100644 --- a/netcon/Intercept.c +++ b/netcon/Intercept.c @@ -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; diff --git a/netcon/RPC.c b/netcon/RPC.c index a13ba7aa..17aa650c 100644 --- a/netcon/RPC.c +++ b/netcon/RPC.c @@ -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) { -- cgit v1.2.3