diff options
-rwxr-xr-x | selftest/target/Samba3.pm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index 45705c0028..4b0b725d52 100755 --- a/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm @@ -590,6 +590,11 @@ sub read_pid($$) sub check_or_start($$$$$) { my ($self, $env_vars, $nmbd, $winbindd, $smbd) = @_; + # use a pipe for stdin in the child processes. This allows + # those processes to monitor the pipe for EOF to ensure they + # exit when the test script exits + pipe(STDIN_READER, $env_vars->{STDIN_PIPE}); + unlink($env_vars->{NMBD_TEST_LOG}); print "STARTING NMBD..."; my $pid = fork(); @@ -631,6 +636,9 @@ sub check_or_start($$$$$) { @preargs = split(/ /, $ENV{NMBD_VALGRIND}); } + close($env_vars->{STDIN_PIPE}); + open STDIN, ">&", \*STDIN_READER or die "can't dup STDIN_READER to STDIN: $!"; + exec(@preargs, Samba::bindir_path($self, "nmbd"), "-F", "--no-process-group", "--log-stdout", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or die("Unable to start nmbd: $!"); } write_pid($env_vars, "nmbd", $pid); @@ -679,6 +687,9 @@ sub check_or_start($$$$$) { print "Starting winbindd with config $env_vars->{SERVERCONFFILE}\n"; + close($env_vars->{STDIN_PIPE}); + open STDIN, ">&", \*STDIN_READER or die "can't dup STDIN_READER to STDIN: $!"; + exec(@preargs, Samba::bindir_path($self, "winbindd"), "-F", "--no-process-group", "--stdout", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or die("Unable to start winbindd: $!"); } write_pid($env_vars, "winbindd", $pid); @@ -722,11 +733,17 @@ sub check_or_start($$$$$) { if(defined($ENV{SMBD_VALGRIND})) { @preargs = split(/ /,$ENV{SMBD_VALGRIND}); } + + close($env_vars->{STDIN_PIPE}); + open STDIN, ">&", \*STDIN_READER or die "can't dup STDIN_READER to STDIN: $!"; + exec(@preargs, Samba::bindir_path($self, "smbd"), "-F", "--no-process-group", "--log-stdout", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or die("Unable to start smbd: $!"); } write_pid($env_vars, "smbd", $pid); print "DONE\n"; + close(STDIN_READER); + return 0; } |