diff options
| author | pooka <pooka@NetBSD.org> | 2011-02-06 19:00:53 +0000 |
|---|---|---|
| committer | pooka <pooka@NetBSD.org> | 2011-02-06 19:00:53 +0000 |
| commit | bce289aede70790468b2bfcf4d7ac33e8903c03e (patch) | |
| tree | be4eaf799798977e1e2bc37ed909dc72051abc97 /libexec/httpd | |
| parent | b8121e9b4d1fb647b4f673c4683c6b1ee653ad1f (diff) | |
Call daemon() later to make sure there is a listening socket by
the time the foreground process exits.
discussed with mrg.
Diffstat (limited to 'libexec/httpd')
| -rw-r--r-- | libexec/httpd/daemon-bozo.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libexec/httpd/daemon-bozo.c b/libexec/httpd/daemon-bozo.c index bf95e0e5160..d65b19b858f 100644 --- a/libexec/httpd/daemon-bozo.c +++ b/libexec/httpd/daemon-bozo.c @@ -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 @@ bozo_daemon_init(bozohttpd_t *httpd) 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 @@ bozo_daemon_init(bozohttpd_t *httpd) 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); } |
