You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ab...@apache.org on 2026/10/21 05:12:42 UTC

svn commit: r1939304 - in httpd/httpd/trunk: changes-entries server

Author: abernal
Date: Wed Oct 21 05:12:42 2026
New Revision: 1939304

Log:
core: Propagate make_sock() failures when duplicating listeners

ap_duplicate_listeners() ignored the return value of make_sock() for a
duplicated listener. On failure make_sock() logs the error and closes
the socket, but the loop carried on with the closed listener: with one
Listen the server started or restarted with fewer listeners, and with
several it failed on the closed descriptor with a misleading "Bad file
descriptor". Return the error so that the MPM reports "could not
duplicate listeners" with the original status.

PR: 70106
Submitted by: Xuqing Yang
GitHub: closes #861

Added:
   httpd/httpd/trunk/changes-entries/core-duplicate-listeners.txt
Modified:
   httpd/httpd/trunk/server/listen.c

Added: httpd/httpd/trunk/changes-entries/core-duplicate-listeners.txt
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ httpd/httpd/trunk/changes-entries/core-duplicate-listeners.txt	Wed Oct 21 05:12:42 2026	(r1939304)
@@ -0,0 +1,3 @@
+  *) core: Fail startup or restart when a duplicated listening socket
+     cannot be initialized, instead of continuing with a broken listener.
+     PR 70106. [Xuqing Yang]

Modified: httpd/httpd/trunk/server/listen.c
==============================================================================
--- httpd/httpd/trunk/server/listen.c	Wed Oct 21 04:31:32 2026	(r1939303)
+++ httpd/httpd/trunk/server/listen.c	Wed Oct 21 05:12:42 2026	(r1939304)
@@ -910,7 +910,10 @@ AP_DECLARE(apr_status_t) ap_duplicate_li
                                 duplr->bind_addr);
                     return stat;
                 }
-                make_sock(p, duplr, 1);
+                stat = make_sock(p, duplr, 1);
+                if (stat != APR_SUCCESS) {
+                    return stat;
+                }
             }
 #if AP_NONBLOCK_WHEN_MULTI_LISTEN
             use_nonblock = (ap_listeners && ap_listeners->next);