summaryrefslogtreecommitdiffstats
path: root/daemon
diff options
context:
space:
mode:
authorwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-11 18:52:59 +0800
committerwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-11 18:52:59 +0800
commit03844c28ba490307de77982a80355cc56e568551 (patch)
tree4def1d1a4627cd733c9bcf7502ee3b0ba53a891e /daemon
parent5588e96b39c1b7d8df72b9d370637de303af44fe (diff)
downloadpttbbs-03844c28ba490307de77982a80355cc56e568551.tar
pttbbs-03844c28ba490307de77982a80355cc56e568551.tar.gz
pttbbs-03844c28ba490307de77982a80355cc56e568551.tar.bz2
pttbbs-03844c28ba490307de77982a80355cc56e568551.tar.lz
pttbbs-03844c28ba490307de77982a80355cc56e568551.tar.xz
pttbbs-03844c28ba490307de77982a80355cc56e568551.tar.zst
pttbbs-03844c28ba490307de77982a80355cc56e568551.zip
Move SIGHUP handler after daemonize
Call event_reinit after daemonize (for kqueue) git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4561 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'daemon')
-rw-r--r--daemon/logind/logind.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/daemon/logind/logind.c b/daemon/logind/logind.c
index d8220362..91053b9e 100644
--- a/daemon/logind/logind.c
+++ b/daemon/logind/logind.c
@@ -1338,9 +1338,7 @@ main(int argc, char *argv[])
reload_data();
- event_init();
- signal_set(&ev_sighup, SIGHUP, sighup_cb, &ev_sighup);
- signal_add(&ev_sighup, NULL);
+ struct event_base *evb = event_init();
// bind ports
if (port && bind_port(port) < 0)
@@ -1379,6 +1377,13 @@ main(int argc, char *argv[])
daemonize(BBSHOME "/run/logind.pid", NULL);
}
+ // Some event notification mechanisms don't work across forks (e.g. kqueue)
+ event_reinit(evb);
+
+ // SIGHUP handler is reset in daemonize()
+ signal_set(&ev_sighup, SIGHUP, sighup_cb, &ev_sighup);
+ signal_add(&ev_sighup, NULL);
+
// create tunnel
if ( (tfd = tobindex(tunnel_path, 1, _set_bind_opt, 1)) < 0)
{