commit 9f292dd: [Minor] Fix some error reporting

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Jun 9 13:49:13 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-06-09 14:42:56 +0100
URL: https://github.com/rspamd/rspamd/commit/9f292ddb10e2e87c08c3caa6478fffb13243d6d1 (HEAD -> master)

[Minor] Fix some error reporting

---
 src/libserver/worker_util.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c
index f1afcce0f..df3cb7fdf 100644
--- a/src/libserver/worker_util.c
+++ b/src/libserver/worker_util.c
@@ -976,8 +976,10 @@ rspamd_maybe_reuseport_socket (struct rspamd_worker_listen_socket *ls)
 
 	/* This means that we have an fd with no listening enabled */
 	if (nfd != -1) {
-		if (listen (nfd, -1) == -1) {
-			return false;
+		if (ls->type == RSPAMD_WORKER_SOCKET_TCP) {
+			if (listen (nfd, -1) == -1) {
+				return false;
+			}
 		}
 	}
 
@@ -991,7 +993,7 @@ rspamd_maybe_reuseport_socket (struct rspamd_worker_listen_socket *ls)
  * @param cf
  * @param listen_sockets
  */
-static void
+static void __attribute__((noreturn))
 rspamd_handle_child_fork (struct rspamd_worker *wrk,
 						  struct rspamd_main *rspamd_main,
 						  struct rspamd_worker_conf *cf,
@@ -1063,7 +1065,12 @@ rspamd_handle_child_fork (struct rspamd_worker *wrk,
 		struct rspamd_worker_listen_socket *ls =
 				(struct rspamd_worker_listen_socket *)cur->data;
 
-		rspamd_maybe_reuseport_socket (ls);
+		if (!rspamd_maybe_reuseport_socket (ls)) {
+			msg_err ("cannot listen on socket %s: %s",
+					rspamd_inet_address_to_string_pretty (ls->addr),
+					strerror (errno));
+		}
+
 		cur = g_list_next (cur);
 	}
 


More information about the Commits mailing list