Subject: | Net::Server::PreFork uses $! incorrectly, reports invalid errors |
run_n_children() doesn't localize $! before calling fork, and
furthermore if the fork fails it does a close() on two filehandles,
which would corrupt the value of $! even if it was set correctly.
Here's a fork that's failing (I haven't found out why yet) which will
report "Bad Fork [Illegal seek]":
my $pid = fork;
### trouble
if( not defined $pid ){
if( $prop->{child_communication} ){
$parentsock->close();
$childsock->close();
}
$self->fatal("Bad fork [$!]");
Instead you should do:
local $!;
my $pid = fork();
my $pid_error = "$!";
etc. then say "Bad fork [$pid_error]".