Module Name: src
Committed By: pooka
Date: Sun Feb 6 19:00:54 UTC 2011
Modified Files:
src/libexec/httpd: daemon-bozo.c
Log Message:
Call daemon() later to make sure there is a listening socket by
the time the foreground process exits.
discussed with mrg.
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/libexec/httpd/daemon-bozo.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/libexec/httpd/daemon-bozo.c
diff -u src/libexec/httpd/daemon-bozo.c:1.11 src/libexec/httpd/daemon-bozo.c:1.12
--- src/libexec/httpd/daemon-bozo.c:1.11 Tue Jun 22 05:24:12 2010
+++ src/libexec/httpd/daemon-bozo.c Sun Feb 6 19:00:53 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: daemon-bozo.c,v 1.11 2010/06/22 05:24:12 mrg Exp $ */
+/* $NetBSD: daemon-bozo.c,v 1.12 2011/02/06 19:00:53 pooka Exp $ */
/* $eterna: daemon-bozo.c,v 1.22 2010/06/21 06:45:45 mrg Exp $ */
@@ -79,12 +79,7 @@
if (!httpd->background)
return;
- if (httpd->foreground == 0)
- daemon(1, 0);
-
portnum = (httpd->bindport) ? httpd->bindport : "http";
- bozo_warn(httpd, "started in daemon mode as `%s' port `%s' root `%s'",
- httpd->virthostname, portnum, httpd->slashdir);
memset(&h, 0, sizeof(h));
h.ai_family = PF_UNSPEC;
@@ -121,6 +116,12 @@
httpd->nsock = i;
freeaddrinfo(r0);
+ if (httpd->foreground == 0)
+ daemon(1, 0);
+
+ bozo_warn(httpd, "started in daemon mode as `%s' port `%s' root `%s'",
+ httpd->virthostname, portnum, httpd->slashdir);
+
signal(SIGCHLD, sigchild);
}