From 5fbc6d8782715e0366f3d7e87e3ddb0dc4a8131d Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Fri, 11 Jun 2021 07:34:02 -0400 Subject: Added failure reasons to all the failure log messages in `init_socket()`. --- pullreqd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pullreqd.c b/pullreqd.c index 4e04f5b..a00d85c 100644 --- a/pullreqd.c +++ b/pullreqd.c @@ -148,9 +148,10 @@ int init_socket(config *cfg) { return -1; } + /* Did we fail to bind the listen socket? */ if (bind(fd, &sock_addr.sa, sockaddr_size) < 0) { - syslog(LOG_ERR, "Failed to bind listen socket."); + syslog(LOG_ERR, "Failed to bind listen socket. Reason: %s", strerror(errno)); return -1; } @@ -158,13 +159,13 @@ int init_socket(config *cfg) { /* Did we fail to enable SO_REUSEADDR? */ if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)) < 0) { - syslog(LOG_ERR, "Failed to enable SO_REUSEADDR."); + syslog(LOG_ERR, "Failed to enable SO_REUSEADDR. Reason: %s", strerror(errno)); return -1; } /* Did we fail to listen to the socket? */ if (listen(fd, 20) < 0) { - syslog(LOG_ERR, "Failed to listen to socket."); + syslog(LOG_ERR, "Failed to listen to socket. Reason: %s", strerror(errno)); return -1; } -- cgit v1.2.3-13-gbd6f