From 40b6a6eda34f4558a5c9187d0c2a445d791c8ce2 Mon Sep 17 00:00:00 2001 From: Maxim Zakharov Date: Thu, 30 Jul 2015 11:49:20 +1000 Subject: [PATCH] daemonize: exit parent without triggering atexit() processing --- ccan/daemonize/daemonize.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); -- 2.39.2