From 743edac6c84ac207d0bb4c3124b0e8fe450a38b4 Mon Sep 17 00:00:00 2001 From: Peter Korsgaard Date: Wed, 9 Nov 2011 19:44:37 +0100 Subject: bb_daemonize_or_rexec(): add flag to double-fork; use it in start-stop-daemon Add a DAEMON_DOUBLE_FORK flag to make bb_daemonize double-fork so it isn't a session leader, and hence doesn't get a controlling tty on Linux if a tty is ever opened, similar to how libdaemon's daemon_fork or the big start-stop-daemon does it - And use it in start-stop-daemon. For details, see http://www.win.tue.nl/~aeb/linux/lk/lk-10.html#ss10.3 Signed-off-by: Peter Korsgaard Signed-off-by: Denys Vlasenko --- debianutils/start_stop_daemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'debianutils') diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c index 02609c04f..495ed0a09 100644 --- a/debianutils/start_stop_daemon.c +++ b/debianutils/start_stop_daemon.c @@ -474,7 +474,7 @@ int start_stop_daemon_main(int argc UNUSED_PARAM, char **argv) *--argv = startas; if (opt & OPT_BACKGROUND) { #if BB_MMU - bb_daemonize(DAEMON_DEVNULL_STDIO + DAEMON_CLOSE_EXTRA_FDS); + bb_daemonize(DAEMON_DEVNULL_STDIO + DAEMON_CLOSE_EXTRA_FDS + DAEMON_DOUBLE_FORK); /* DAEMON_DEVNULL_STDIO is superfluous - * it's always done by bb_daemonize() */ #else -- cgit v1.2.3