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 2011/05/08 23:19:43 UTC

svn commit: r1100818 - /spamassassin/branches/3.3/spamd/spamd.raw

Author: mmartinec
Date: Sun May  8 21:19:43 2011
New Revision: 1100818

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

Modified:
    spamassassin/branches/3.3/spamd/spamd.raw

Modified: spamassassin/branches/3.3/spamd/spamd.raw
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.3/spamd/spamd.raw?rev=1100818&r1=1100817&r2=1100818&view=diff
==============================================================================
--- spamassassin/branches/3.3/spamd/spamd.raw (original)
+++ spamassassin/branches/3.3/spamd/spamd.raw Sun May  8 21:19:43 2011
@@ -2483,8 +2483,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;