Handle expected signals in tsiggss authsock.pl script
When the authsock.pl script would be terminated with a signal, it would leave the pidfile around. This commit adds a signal handler that cleanups the pidfile on signals that are expected.
This commit is contained in:
committed by
Ondřej Surý
parent
f8c6872beb
commit
216a97188d
@@ -42,6 +42,11 @@ open(my $pid,">",$pidfile)
|
||||
print $pid "$$\n";
|
||||
close($pid);
|
||||
|
||||
# close gracefully
|
||||
sub rmpid { unlink "$pidfile"; exit 1; };
|
||||
$SIG{INT} = \&rmpid;
|
||||
$SIG{TERM} = \&rmpid;
|
||||
|
||||
if ($timeout != 0) {
|
||||
# die after the given timeout
|
||||
alarm($timeout);
|
||||
|
||||
Reference in New Issue
Block a user