Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/httpd Call daemon() later to make sure there is a li...



details:   https://anonhg.NetBSD.org/src/rev/53c9c9a78325
branches:  trunk
changeset: 761745:53c9c9a78325
user:      pooka <pooka%NetBSD.org@localhost>
date:      Sun Feb 06 19:00:53 2011 +0000

description:
Call daemon() later to make sure there is a listening socket by
the time the foreground process exits.

discussed with mrg.

diffstat:

 libexec/httpd/daemon-bozo.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (35 lines):

diff -r 3722ad82ff2b -r 53c9c9a78325 libexec/httpd/daemon-bozo.c
--- a/libexec/httpd/daemon-bozo.c       Sun Feb 06 18:50:59 2011 +0000
+++ b/libexec/httpd/daemon-bozo.c       Sun Feb 06 19:00:53 2011 +0000
@@ -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);
 }
 



Home | Main Index | Thread Index | Old Index