From 170ee75143501719f9a4230ed8859719965d290e Mon Sep 17 00:00:00 2001 From: "David A. Madore" Date: Tue, 16 Feb 2010 17:54:49 +0100 Subject: 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. --- emergencyd.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 { -- cgit v1.2.3