summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid A. Madore <david+config@madore.org>2010-02-16 16:54:49 (GMT)
committerDavid A. Madore <david+config@madore.org>2010-02-16 16:54:49 (GMT)
commit170ee75143501719f9a4230ed8859719965d290e (patch)
tree480ebfc448b500c439e8ade46388ebcde4b013ec
parent8eeeb14f4284e2ee1fa040ae0209a6c02432005d (diff)
downloademergency-170ee75143501719f9a4230ed8859719965d290e.zip
emergency-170ee75143501719f9a4230ed8859719965d290e.tar.gz
emergency-170ee75143501719f9a4230ed8859719965d290e.tar.bz2
The incomprehensible rules of Unix B&D dictate that setsid should move.
Gratuitous annoyance: setsid does not work for a process group leader, so we have to do it after the fork.
-rwxr-xr-xemergencyd.pl2
1 files changed, 1 insertions, 1 deletions
diff --git a/emergencyd.pl b/emergencyd.pl
index 47c39e4..c37b938 100755
--- a/emergencyd.pl
+++ b/emergencyd.pl
@@ -106,7 +106,6 @@ bind $socket, sockaddr_in6($port, in6addr_any) or die "Can't bind socket: $!";
if ( $opts{f} ) {
chdir("/");
open STDIN, "/dev/null";
- POSIX::setsid;
$SIG{HUP} = "IGNORE";
$SIG{INT} = "IGNORE";
my $childpid = fork;
@@ -115,6 +114,7 @@ if ( $opts{f} ) {
print "$childpid\n";
exit 0;
}
+ POSIX::setsid;
}
sub curtime {