On Fri, 16 Jul 2004 21:52:58 -0700
Robert Spier <[EMAIL PROTECTED]> wrote:
> > +    ## call srand(), else we will have (e.g.) the same tempfile in
> > +    ## _all_ children 
> > +    ## i.e. after 'use File::Temp; ($fh,$name)=tempfile();' in a
> > plugin+    srand( ($$ ^ $port) ^ (time ^ unpack("C*", $iaddr)) );
> >  
> >      close($server);
> 
> What version of perl are you using?  That shouldn't be necessary, and
> I can't replicate the problem.
> 
> perl -MFile::Temp=tempfile -le' print $]; for(1..4) { unless ( fork()
> ) { ($h,$n) = tempfile();  print "$_:$n"; exit; } } while(wait>0){1};'
> 5.008003
> 1:/tmp/uNb2fHtfHs
> 2:/tmp/R039hLPiKO
> 3:/tmp/Wish2wqoM7
> 4:/tmp/488A0F4Hrx
> 
> All children.  All forked.  No srand.  All different.
Same here... 

but:
# zgrep 'kavscanner plugin: Running:' /var/log/mail.log.1.gz
Jul 15 06:26:19 mail qpsmtpd: 31027 kavscanner plugin: Running:
/opt/AVP/kavscanner -Y -P -B -MP -MD -* /tmp/uV7UIj6NQE 2>&1
Jul 15 06:26:49 mail qpsmtpd: 31044 kavscanner plugin: Running:
/opt/AVP/kavscanner -Y -P -B -MP -MD -* /tmp/uV7UIj6NQE 2>&1
Jul 15 06:28:36 mail qpsmtpd: 31061 kavscanner plugin: Running:
/opt/AVP/kavscanner -Y -P -B -MP -MD -* /tmp/uV7UIj6NQE 2>&1
Jul 15 06:30:13 mail qpsmtpd: 31081 kavscanner plugin: Running:
/opt/AVP/kavscanner -Y -P -B -MP -MD -* /tmp/uV7UIj6NQE 2>&1
Jul 15 06:31:59 mail qpsmtpd: 31099 kavscanner plugin: Running:
/opt/AVP/kavscanner -Y -P -B -MP -MD -* /tmp/uV7UIj6NQE 2>&1
....

and with srand() all is ok.

Hanno

Reply via email to