cvs commit: qpsmtpd qpsmtpd-forkserver
[email protected] (Matt Sergeant)
| Newsgroups | perl.cvs.qpsmtpd |
|---|---|
| Message-ID | <[email protected]> |
cvsuser 04/08/09 01:13:26 Modified: . qpsmtpd-forkserver Log: When REAPER is called by SIGCHLD, it can start in the middle of the loop over values %childstatus in the MAXCONNIP block. This can cause $rip to be deleted by REAPER while we're using it. Perl will die saying "Use of freed value in iteration". -- [email protected] Revision Changes Path 1.9 +5 -1 qpsmtpd/qpsmtpd-forkserver Index: qpsmtpd-forkserver =================================================================== RCS file: /cvs/public/qpsmtpd/qpsmtpd-forkserver,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -r1.8 -r1.9 --- qpsmtpd-forkserver 18 Jul 2004 01:29:00 -0000 1.8 +++ qpsmtpd-forkserver 9 Aug 2004 08:13:26 -0000 1.9 @@ -114,7 +114,11 @@ my ($port, $iaddr) = sockaddr_in($hisaddr); if ($MAXCONNIP) { my $num_conn = 0; - foreach my $rip (values %childstatus) { + # If we for-loop directly over values %childstatus, a SIGCHLD can call + # REAPER and slip $rip out from under us. Causes "Use of freed value in + # iteration" under perl 5.8.4. + my @rip = values %childstatus; + foreach my $rip (@rip) { if ($rip eq $iaddr) { ++$num_conn; }