]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Fix some error reporting
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 9 Jun 2020 13:42:56 +0000 (14:42 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 9 Jun 2020 13:42:56 +0000 (14:42 +0100)
src/libserver/worker_util.c

index f1afcce0fc5a64fdfd33418492b8fe00bfd5a350..df3cb7fdf189e09e87bb975a30822376f02e9e83 100644 (file)
@@ -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);
        }