]> granicus.if.org Git - curl/commitdiff
make 'checkdied' in runtests.pl more robust
authorYang Tse <yangsita@gmail.com>
Fri, 23 Nov 2007 12:18:45 +0000 (12:18 +0000)
committerYang Tse <yangsita@gmail.com>
Fri, 23 Nov 2007 12:18:45 +0000 (12:18 +0000)
tests/runtests.pl

index f2ed1650daf8bc3b6b94a25ec1cf71f01d623af7..9e5a8674c1a18641f96f54aa9a9b0b49f06e32b2 100755 (executable)
@@ -258,8 +258,11 @@ $ENV{'CURL_CA_BUNDLE'}=undef;
 sub checkdied {
     use POSIX ":sys_wait_h";
     my $pid = $_[0];
+    if(not defined $pid || $pid <= 0) {
+        return 0;
+    }
     my $rc = waitpid($pid, &WNOHANG);
-    return $rc == $pid;
+    return ($rc == $pid)?1:0;
 }
 
 #######################################################################