From 250c02554ec3dd52f33e33406fdd605f5d932d5f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 21 Mar 2006 13:16:50 +0000 Subject: r14618: add --no-process-group to all server programms to make the following possible: timelimit 20000 bin/nmbd -F -S --no-process-group timelimit 20000 bin/smbd -F -S --no-process-group this is needed to 'make test' working without losing child processes metze (This used to be commit c3a9f30e2a12cc852c9fa3a7d161f5c6ee0694ce) --- source3/nmbd/nmbd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source3/nmbd') diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index 38183159a2..f58c389fc9 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -658,11 +658,13 @@ static BOOL open_sockets(BOOL isdaemon, int port) static BOOL opt_interactive; poptContext pc; static char *p_lmhosts = dyn_LMHOSTSFILE; + static BOOL no_process_group = False; struct poptOption long_options[] = { POPT_AUTOHELP {"daemon", 'D', POPT_ARG_VAL, &is_daemon, True, "Become a daemon(default)" }, {"interactive", 'i', POPT_ARG_VAL, &opt_interactive, True, "Run interactive (not a daemon)" }, {"foreground", 'F', POPT_ARG_VAL, &Fork, False, "Run daemon in foreground (for daemontools & etc)" }, + {"no-process-group", 0, POPT_ARG_VAL, &no_process_group, True, "Don't create a new process group" }, {"log-stdout", 'S', POPT_ARG_VAL, &log_stdout, True, "Log to stdout" }, {"hosts", 'H', POPT_ARG_STRING, &p_lmhosts, 'H', "Load a netbios hosts file"}, {"port", 'p', POPT_ARG_INT, &global_nmb_port, NMB_PORT, "Listen on the specified port" }, @@ -749,7 +751,7 @@ static BOOL open_sockets(BOOL isdaemon, int port) if (is_daemon && !opt_interactive) { DEBUG( 2, ( "Becoming a daemon.\n" ) ); - become_daemon(Fork); + become_daemon(Fork, no_process_group); } #if HAVE_SETPGID @@ -757,7 +759,7 @@ static BOOL open_sockets(BOOL isdaemon, int port) * If we're interactive we want to set our own process group for * signal management. */ - if (opt_interactive) + if (opt_interactive && !no_process_group) setpgid( (pid_t)0, (pid_t)0 ); #endif -- cgit