diff options
author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-12-03 13:50:53 +0100 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-12-03 13:50:53 +0100 |
commit | ef2e50b94fbc7ce1c7dbe1f2ea860e6ab0724726 (patch) | |
tree | 0e26e0987aeaf50f9fd2f4f8a48fe3bc562b7cb1 /src/lib/sockets.c | |
parent | f1d67740ee202c6c3af2061df8cafdd265061b59 (diff) | |
download | ouroboros-ef2e50b94fbc7ce1c7dbe1f2ea860e6ab0724726.tar.gz ouroboros-ef2e50b94fbc7ce1c7dbe1f2ea860e6ab0724726.zip |
lib: Remove logs from stable sources
This removes log output in applications and some size_t printf errors
when compiling on 32 bit machines.
Diffstat (limited to 'src/lib/sockets.c')
-rw-r--r-- | src/lib/sockets.c | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/src/lib/sockets.c b/src/lib/sockets.c index a1517b7b..5c09e65e 100644 --- a/src/lib/sockets.c +++ b/src/lib/sockets.c @@ -20,17 +20,15 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define OUROBOROS_PREFIX "libouroboros-sockets" - #include <ouroboros/config.h> #include <ouroboros/errno.h> -#include <ouroboros/logs.h> #include <ouroboros/sockets.h> #include <ouroboros/utils.h> #include <sys/socket.h> #include <sys/un.h> #include <string.h> +#include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <stdbool.h> @@ -42,10 +40,8 @@ int client_socket_open(char * file_name) struct sockaddr_un serv_addr; sockfd = socket(AF_UNIX, SOCK_STREAM, 0); - if (sockfd < 0) { - LOG_ERR("Failed to open socket"); + if (sockfd < 0) return -1; - } serv_addr.sun_family = AF_UNIX; sprintf(serv_addr.sun_path, "%s", file_name); @@ -53,7 +49,6 @@ int client_socket_open(char * file_name) if (connect(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr))) { - LOG_ERR("Failed to connect to daemon"); close(sockfd); return -1; } @@ -68,18 +63,13 @@ int server_socket_open(char * file_name) if (access(file_name, F_OK) != -1) { /* File exists */ - if (unlink(file_name)) { - LOG_ERR("Failed to unlink filename: %s", - strerror(errno)); + if (unlink(file_name)) return -1; - } } sockfd = socket(AF_UNIX, SOCK_STREAM, 0); - if (sockfd < 0) { - LOG_ERR("Failed to open socket"); + if (sockfd < 0) return -1; - } serv_addr.sun_family = AF_UNIX; sprintf(serv_addr.sun_path, "%s", file_name); @@ -87,13 +77,11 @@ int server_socket_open(char * file_name) if (bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr))) { - LOG_ERR("Failed to bind socket"); close(sockfd); return -1; } if (listen(sockfd, 0)) { - LOG_ERR("Failed to listen to socket"); close(sockfd); return -1; } @@ -120,9 +108,8 @@ static irm_msg_t * send_recv_irm_msg_timed(irm_msg_t * msg, bool timed) return NULL; if (timed) - if (setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, - (void *) &tv, sizeof(tv))) - LOG_WARN("Failed to set timeout on socket."); + setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, + (void *) &tv, sizeof(tv)); buf.len = irm_msg__get_packed_size(msg); if (buf.len == 0) { |