in reply to Daemon sub refuses to daemonize. Why?
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!"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Daemon sub refuses to daemonize. Why?
by BMaximus (Chaplain) on May 18, 2001 at 04:44 UTC | |
by converter (Priest) on May 18, 2001 at 05:02 UTC |