Permalink
Browse files

save PID after forking but before changing privileges

  • Loading branch information...
abarisani committed Aug 2, 2017
1 parent ec12ae6 commit d0e7f28c13ffbd5888b31d6532c2faf78f10f176
Showing with 2 additions and 3 deletions.
  1. +2 −3 tenshi
View
5 tenshi
@@ -122,9 +122,6 @@ if ($listen) {
$SIG{'CHLD'} = sub { $debug && debug(5,'CHLD') ; print RED "[ERROR] child died, bailing out\n"; $time_to_die = 1; };
save_pid();
prepare_process();
#
# sanity checks
#
@@ -1023,6 +1020,8 @@ sub daemonize {
defined(my $pid = fork) or clean_up and die RED "[ERROR] can't fork: $!\n";
exit if $pid;
setsid() or clean_up and die RED "[ERROR] can't start a new session: $!\n";
save_pid();
prepare_process();
}
sub save_pid {

0 comments on commit d0e7f28

Please sign in to comment.