From b182e9ad6011909fdb76358431d23d195febaf54 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 4 Aug 2017 23:04:17 +0200 Subject: libbb: use _exit, not exit, in bb_daemonize_or_rexec() By the time we reach exit in parent, child already exited or execed. We should not re-run libc cleanup code. While at it, introduce bb_daemon_helper() and add a few comments. Signed-off-by: Denys Vlasenko --- printutils/lpd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'printutils') diff --git a/printutils/lpd.c b/printutils/lpd.c index 3fdba5d2b..662d3a224 100644 --- a/printutils/lpd.c +++ b/printutils/lpd.c @@ -198,9 +198,8 @@ int lpd_main(int argc UNUSED_PARAM, char *argv[]) q = p; // next line } // helper should not talk over network. - // this call reopens stdio fds to "/dev/null" - // (no daemonization is done) - bb_daemonize_or_rexec(DAEMON_DEVNULL_STDIO | DAEMON_ONLY_SANITIZE, NULL); + // this call reopens stdio fds to "/dev/null". + bb_daemon_helper(DAEMON_DEVNULL_STDIO); BB_EXECVP_or_die(argv); } -- cgit v1.2.3