diff options
author | rofl0r <rofl0r@users.noreply.github.com> | 2020-09-17 21:03:51 +0100 |
---|---|---|
committer | rofl0r <rofl0r@users.noreply.github.com> | 2020-09-17 21:03:51 +0100 |
commit | da1bc1425d954ab5f3cb518fac10286ba958c3bc (patch) | |
tree | 22ae8bd33462c240ce07fb096ac9c8efb0f1e96f /src | |
parent | 22e4898519e9db7aabacad1343c20fc49176dbf4 (diff) |
tune error messages to show select or poll depending on what is used
Diffstat (limited to 'src')
-rw-r--r-- | src/child.c | 8 | ||||
-rw-r--r-- | src/mypoll.h | 2 | ||||
-rw-r--r-- | src/reqs.c | 8 |
3 files changed, 10 insertions, 8 deletions
diff --git a/src/child.c b/src/child.c index 89a081c..a4a90f6 100644 --- a/src/child.c +++ b/src/child.c @@ -99,7 +99,7 @@ void child_main_loop (void) /* * We have to wait for connections on multiple fds, - * so use select. + * so use select/poll/whatever. */ while (!config->quit) { @@ -136,11 +136,11 @@ void child_main_loop (void) if (errno == EINTR) { continue; } - log_message (LOG_ERR, "error calling select: %s", + log_message (LOG_ERR, "error calling " SELECT_OR_POLL ": %s", strerror(errno)); continue; } else if (ret == 0) { - log_message (LOG_WARNING, "Strange: select returned 0 " + log_message (LOG_WARNING, "Strange: " SELECT_OR_POLL " returned 0 " "but we did not specify a timeout..."); continue; } @@ -158,7 +158,7 @@ void child_main_loop (void) if (listenfd == -1) { log_message(LOG_WARNING, "Strange: None of our listen " - "fds was readable after select"); + "fds was readable after " SELECT_OR_POLL); continue; } diff --git a/src/mypoll.h b/src/mypoll.h index a336680..8736015 100644 --- a/src/mypoll.h +++ b/src/mypoll.h @@ -4,6 +4,7 @@ #include "config.h" #ifdef HAVE_POLL_H +#define SELECT_OR_POLL "poll" #include <poll.h> typedef struct pollfd pollfd_struct; @@ -13,6 +14,7 @@ typedef struct pollfd pollfd_struct; #else +#define SELECT_OR_POLL "select" #include <sys/select.h> typedef struct mypollfd { int fd; @@ -1163,11 +1163,11 @@ static void relay_connection (struct conn_s *connptr) if (ret == 0) { log_message (LOG_INFO, - "Idle Timeout (after select)"); + "Idle Timeout (after " SELECT_OR_POLL ")"); return; } else if (ret < 0) { log_message (LOG_ERR, - "relay_connection: select() error \"%s\". " + "relay_connection: " SELECT_OR_POLL "() error \"%s\". " "Closing connection (client_fd:%d, server_fd:%d)", strerror (errno), connptr->client_fd, connptr->server_fd); @@ -1440,7 +1440,7 @@ get_request_entity(struct conn_s *connptr) if (ret == -1) { log_message (LOG_ERR, - "Error calling select on client fd %d: %s", + "Error calling " SELECT_OR_POLL " on client fd %d: %s", connptr->client_fd, strerror(errno)); } else if (ret == 0) { log_message (LOG_INFO, "no entity"); @@ -1459,7 +1459,7 @@ get_request_entity(struct conn_s *connptr) ret = 0; } } else { - log_message (LOG_ERR, "strange situation after select: " + log_message (LOG_ERR, "strange situation after " SELECT_OR_POLL ": " "ret = %d, but client_fd (%d) is not readable...", ret, connptr->client_fd); ret = -1; |