summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2022-07-18 23:16:18 +0300
committerAleksey Midenkov <midenok@gmail.com>2022-07-18 23:16:18 +0300
commit7ca5c7d8f9c70067db36b76da31671fae430cc9d (patch)
tree7bec5d8ecb1595536fa55c16bc22b037634b00b1
parent1d307ed48a81975cc8a322379b0c6e051d53a44d (diff)
downloadmariadb-git-7ca5c7d8f9c70067db36b76da31671fae430cc9d.tar.gz
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().
-rwxr-xr-xmysql-test/mysql-test-run.pl12
1 files changed, 7 insertions, 5 deletions
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index f3ffdf90547..bb044a1388b 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -661,12 +661,14 @@ sub main {
foreach my $pid (keys %children)
{
my $ret_pid= waitpid($pid, 0);
- if ($ret_pid != $pid){
- mtr_report("Unknown process $ret_pid exited");
- }
- else {
- delete $children{$ret_pid};
+ if ($ret_pid == -1) {
+ # Child was automatically reaped. Probably not possible
+ # unless you $SIG{CHLD}= 'IGNORE'
+ mtr_report("Child ${pid} was automatically reaped (this should never happend)");
+ } elsif ($ret_pid != $pid) {
+ confess("Unexpected PID ${ret_pid} instead of expected ${pid}");
}
+ delete $children{$ret_pid};
}
}