Commit 7ca5c7d8 authored by Aleksey Midenkov's avatar Aleksey Midenkov

MDEV-29023 waitpid() cleanup

The case for "Unknown process $ret_pid exited" is never known to be
valid. Such state is not documented for waitpid().
parent 1d307ed4
...@@ -661,12 +661,14 @@ sub main { ...@@ -661,12 +661,14 @@ sub main {
foreach my $pid (keys %children) foreach my $pid (keys %children)
{ {
my $ret_pid= waitpid($pid, 0); my $ret_pid= waitpid($pid, 0);
if ($ret_pid != $pid){ if ($ret_pid == -1) {
mtr_report("Unknown process $ret_pid exited"); # Child was automatically reaped. Probably not possible
} # unless you $SIG{CHLD}= 'IGNORE'
else { mtr_report("Child ${pid} was automatically reaped (this should never happend)");
delete $children{$ret_pid}; } elsif ($ret_pid != $pid) {
confess("Unexpected PID ${ret_pid} instead of expected ${pid}");
} }
delete $children{$ret_pid};
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment