You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by mm...@apache.org on 2010/06/01 15:51:02 UTC

svn commit: r950076 - /spamassassin/trunk/spamd/spamd.raw

Author: mmartinec
Date: Tue Jun  1 13:51:01 2010
New Revision: 950076

URL: http://svn.apache.org/viewvc?rev=950076&view=rev
Log:
Bug 6376: win32: consider negative pids under windows in spamd's waitpid

Modified:
    spamassassin/trunk/spamd/spamd.raw

Modified: spamassassin/trunk/spamd/spamd.raw
URL: http://svn.apache.org/viewvc/spamassassin/trunk/spamd/spamd.raw?rev=950076&r1=950075&r2=950076&view=diff
==============================================================================
--- spamassassin/trunk/spamd/spamd.raw (original)
+++ spamassassin/trunk/spamd/spamd.raw Tue Jun  1 13:51:01 2010
@@ -2482,8 +2482,16 @@ sub child_handler {
   # children.  This is due to syslog-ng brokenness -- bugs 3625, 4237.
 
   # clean up any children which have exited
-  while((my $pid = waitpid(-1, WNOHANG)) > 0) {
-    my $child_stat = $pid > 0 ? $? : undef;
+  for (;;) {
+    # waitpid returns a pid of the deceased process, or -1 if there is no
+    # such child process. On some systems, a value of 0 indicates that there
+    # are processes still running. Note that Windows uses negative pids for
+    # child processes - bug 6376, bug 6356.
+    #
+    my $pid = waitpid(-1, WNOHANG);
+    last if !$pid || $pid == -1;
+    my $child_stat = $?;
+
     if (!defined $children{$pid}) {
       # ignore this child; we didn't realise we'd forked it. bug 4237
       next;