You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2003/03/31 06:30:39 UTC
cvs commit: httpd-2.0/server listen.c
wrowe 2003/03/30 20:30:39
Modified: server listen.c
Log:
Quit registering *two* cleanups listening sockets prior to exec.
We open them once, register a cleanup only once.
Submitted by: Jeff Trawick
Reviewed by: FirstBill, OtherBill
Revision Changes Path
1.86 +13 -2 httpd-2.0/server/listen.c
Index: listen.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/listen.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -r1.85 -r1.86
--- listen.c 3 Feb 2003 17:53:18 -0000 1.85
+++ listen.c 31 Mar 2003 04:30:38 -0000 1.86
@@ -340,6 +340,8 @@
ap_listen_rec *lr;
ap_listen_rec *next;
int num_open;
+ const char *userdata_key = "ap_listen_open";
+ void *data;
/* Don't allocate a default listener. If we need to listen to a
* port, then the user needs to have a Listen directive in their
@@ -370,8 +372,17 @@
}
old_listeners = NULL;
- apr_pool_cleanup_register(pool, NULL, apr_pool_cleanup_null,
- close_listeners_on_exec);
+ /* we come through here on both passes of the open logs phase
+ * only register the cleanup once... otherwise we try to close
+ * listening sockets twice when cleaning up prior to exec
+ */
+ apr_pool_userdata_get(&data, userdata_key, pool);
+ if (!data) {
+ apr_pool_userdata_set((const void *)1, userdata_key,
+ apr_pool_cleanup_null, pool);
+ apr_pool_cleanup_register(pool, NULL, apr_pool_cleanup_null,
+ close_listeners_on_exec);
+ }
return num_open ? 0 : -1;
}