srand after the fork.

git-svn-id: https://svn.perl.org/qpsmtpd/trunk@272 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Matt Sergeant 2004-07-17 08:45:09 +00:00
parent 96ec52d088
commit ce59fc98b6

View File

@ -142,6 +142,11 @@ while (1) {
die "fork: $!" unless defined $pid; # failure die "fork: $!" unless defined $pid; # failure
# otherwise child # otherwise child
## 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); close($server);
$SIG{$_} = 'DEFAULT' for keys %SIG; $SIG{$_} = 'DEFAULT' for keys %SIG;