From 216a97188d86cb3edb307a40ff5ee61b030eb033 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 20 Jan 2021 13:53:50 +1100 Subject: [PATCH] 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. --- bin/tests/system/tsiggss/authsock.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/tests/system/tsiggss/authsock.pl b/bin/tests/system/tsiggss/authsock.pl index c43cab679f..ab3833d26f 100644 --- a/bin/tests/system/tsiggss/authsock.pl +++ b/bin/tests/system/tsiggss/authsock.pl @@ -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);