From: Maxim Zakharov Date: Thu, 30 Jul 2015 01:49:20 +0000 (+1000) Subject: daemonize: exit parent without triggering atexit() processing X-Git-Url: https://git.ozlabs.org/?a=commitdiff_plain;h=40b6a6eda34f4558a5c9187d0c2a445d791c8ce2;p=ccan daemonize: exit parent without triggering atexit() processing --- 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);