mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
selftest: Close STDIN_PIPE's write end for skipped daemons
Without this, any environment that skips any daemon will not shut down properly. If a copy of a pipe's write end remains, closing one of them won't cause the read end to be readable, i.e. the daemons waiting for that won't exit properly. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
2d5b7c9a50
commit
5bc5b681c0
@ -664,6 +664,11 @@ sub fork_and_exec
|
||||
set_env_for_process($daemon_ctx->{NAME}, $env_vars,
|
||||
$daemon_ctx->{ENV_VARS});
|
||||
|
||||
# we close the child's write-end of the pipe and redirect the read-end
|
||||
# to its stdin. That way the daemon will receive an EOF on stdin when
|
||||
# parent selftest process closes its write-end.
|
||||
close($env_vars->{STDIN_PIPE});
|
||||
|
||||
# not all s3 daemons run in all testenvs (e.g. fileserver doesn't
|
||||
# run winbindd). In which case, the child process just sleeps
|
||||
if (defined($daemon_ctx->{SKIP_DAEMON})) {
|
||||
@ -678,10 +683,6 @@ sub fork_and_exec
|
||||
|
||||
$ENV{MAKE_TEST_BINARY} = $daemon_ctx->{BINARY_PATH};
|
||||
|
||||
# we close the child's write-end of the pipe and redirect the read-end
|
||||
# to its stdin. That way the daemon will receive an EOF on stdin when
|
||||
# parent selftest process closes its write-end.
|
||||
close($env_vars->{STDIN_PIPE});
|
||||
open STDIN, ">&", $STDIN_READER or die "can't dup STDIN_READER to STDIN: $!";
|
||||
|
||||
# if using kernel namespaces, prepend the command so the process runs in
|
||||
|
Loading…
Reference in New Issue
Block a user