diff options
author | Maxim Zakharov <dp.maxime@gmail.com> | 2015-07-30 11:49:20 +1000 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2015-07-30 12:37:54 +0930 |
commit | 40b6a6eda34f4558a5c9187d0c2a445d791c8ce2 (patch) | |
tree | 0daf722ed97975a57a8abfc5d72aeaca288c0b66 | |
parent | 60d22760a069b2adebda59dd68edbe70304584cf (diff) |
daemonize: exit parent without triggering atexit() processing
-rw-r--r-- | ccan/daemonize/daemonize.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ccan/daemonize/daemonize.c b/ccan/daemonize/daemonize.c index 3c0a53a8..d4a0420e 100644 --- a/ccan/daemonize/daemonize.c +++ b/ccan/daemonize/daemonize.c @@ -15,8 +15,9 @@ bool daemonize(void) /* Separate from our parent via fork, so init inherits us. */ if ((pid = fork()) < 0) return false; + /* use _exit() to avoid triggering atexit() processing */ if (pid != 0) - exit(0); + _exit(0); /* Don't hold files open. */ close(STDIN_FILENO); |