Because of or's low precedence, the return statement is evaluated before Perl can check the value returned by IO::File->new. Using || instead allows the check to take place.return IO::File->new($file, O_WRONLY|O_CREAT|O_EXCL,0644) || die "Can't create $file: $!\n";
Insert this code directly above it to untaint $pid:die "Server already running with PID $pid" if kill 0 => $pid;
if ($pid =~ /^(\d+)$/) { $pid = $1; } else { die "funky pid read from $file!"; }
In reply to Re: Daemon sub refuses to daemonize. Why?
by converter
in thread Daemon sub refuses to daemonize. Why?
by BMaximus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |