]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Handle expected signals in tsiggss authsock.pl script
authorMark Andrews <marka@isc.org>
Wed, 20 Jan 2021 02:53:50 +0000 (13:53 +1100)
committerOndřej Surý <ondrej@sury.org>
Thu, 1 Apr 2021 08:19:33 +0000 (10:19 +0200)
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.

bin/tests/system/tsiggss/authsock.pl

index c43cab679f8c61e1364e48506e3d02d13d3e06f8..ab3833d26f01762f305ad4223c2b984b2829946a 100644 (file)
@@ -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);