diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2022-08-03 15:58:52 -0300 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2022-08-03 15:58:52 -0300 |
commit | 2178b6f62737bf78971a9075d96ae66cbb99c993 (patch) | |
tree | 7f72af98da173cbe002cb1cc65406a54c6dc5d0a | |
parent | 8588fb838229b6d08fb34d9a3b8eb7b793b84523 (diff) |
network: Add some more logging output for the errors in `create_socket()`
-rw-r--r-- | network.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -37,7 +37,7 @@ int create_socket(struct sockaddr *sa, size_t sock_len) { /* Did we fail to create the listen socket? */ if (fd < 0) { - log_reason(LOG_ERR, "Failed to create listen socket.", strerror(errno)); + log_reason(LOG_ERR, "Failed to create listen socket for addresss \"%s\".", addr_str, strerror(errno)); return -1; } @@ -49,20 +49,20 @@ int create_socket(struct sockaddr *sa, size_t sock_len) { /* Did we fail to enable SO_REUSEADDR? */ if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)) < 0) { - log_reason(LOG_ERR, "Failed to enable SO_REUSEADDR.", strerror(errno)); + log_reason(LOG_ERR, "Failed to enable SO_REUSEADDR for socket %i.", fd, strerror(errno)); ret = -1; } /* Did we fail to bind the listen socket? */ if (ret >= 0 && bind(fd, sa, sock_len) < 0) { - log_reason(LOG_ERR, "Failed to bind listen socket.", strerror(errno)); + log_reason(LOG_ERR, "Failed to bind listen socket %i with address \"%s\".", fd, addr_str, strerror(errno)); ret = -1; } /* Did we fail to listen to the socket? */ if (ret >= 0 && listen(fd, 20) < 0) { - log_reason(LOG_ERR, "Failed to listen to socket.", strerror(errno)); + log_reason(LOG_ERR, "Failed to listen to socket %i.", fd, strerror(errno)); ret = -1; } |