On 17 Jul 2004, at 05:52, Robert Spier 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.

I've seen this before - it might depend on loaded modules (e.g. a module might call srand in the parent). I've applied the patch anyway as it's sensible.


Matt.



Reply via email to