runtests.pl/stopserver: space separate pids
authorDaniel Stenberg <daniel@haxx.se>
Tue, 22 Feb 2011 12:28:27 +0000 (13:28 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 22 Feb 2011 12:42:00 +0000 (13:42 +0100)
The stopserver function would append pids to kill and could append them
without separating them with space properly. The result would be a very
large number that by (some implementations of) kill would be interpreted
as a negative number and that process group would be wiped...

Bug: http://curl.haxx.se/bug/view.cgi?id=3188836
Reported by: Greg Pratt

tests/runtests.pl

index d931b15..806ee98 100755 (executable)
@@ -651,7 +651,9 @@ sub stopserver {
     #
     foreach my $server (@killservers) {
         if($run{$server}) {
-            $pidlist .= "$run{$server} ";
+            # we must prepend a space since $pidlist may already contain
+            # a pid
+            $pidlist .= " $run{$server}";
             $run{$server} = 0;
         }
         $runcert{$server} = 0 if($runcert{$server});