Commit 40b6a6ed authored by Maxim Zakharov's avatar Maxim Zakharov Committed by Rusty Russell

daemonize: exit parent without triggering atexit() processing

parent 60d22760
...@@ -15,8 +15,9 @@ bool daemonize(void) ...@@ -15,8 +15,9 @@ bool daemonize(void)
/* Separate from our parent via fork, so init inherits us. */ /* Separate from our parent via fork, so init inherits us. */
if ((pid = fork()) < 0) if ((pid = fork()) < 0)
return false; return false;
/* use _exit() to avoid triggering atexit() processing */
if (pid != 0) if (pid != 0)
exit(0); _exit(0);
/* Don't hold files open. */ /* Don't hold files open. */
close(STDIN_FILENO); close(STDIN_FILENO);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment