summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorJeremie Courreges-Anglas <jca@cvs.openbsd.org>2022-06-02 21:38:47 +0000
committerJeremie Courreges-Anglas <jca@cvs.openbsd.org>2022-06-02 21:38:47 +0000
commit8ce2982197b04b078d55c7795298bf5b5504507a (patch)
tree0439c03bd904ed2d8186e0b6049770b9cfd5e036 /usr.sbin
parent5a4287e6512b96bc52b43a2e3267b116bdf12595 (diff)
Let btrace(8) execute the END probe upon receiving a SIGTERM signal
While SIGINT (already handled) makes sense for interactive use, handling SIGTERM in the same manner is less surprising for scripting. This lets you do: btrace ... & some workload; kill $! and get the expected output. ok mpi@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/btrace/btrace.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/btrace/btrace.c b/usr.sbin/btrace/btrace.c
index 5daaab1f969..1292f71323c 100644
--- a/usr.sbin/btrace/btrace.c
+++ b/usr.sbin/btrace/btrace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: btrace.c,v 1.62 2022/02/22 17:26:04 deraadt Exp $ */
+/* $OpenBSD: btrace.c,v 1.63 2022/06/02 21:38:46 jca Exp $ */
/*
* Copyright (c) 2019 - 2021 Martin Pieuchot <mpi@openbsd.org>
@@ -385,6 +385,8 @@ rules_do(int fd)
sa.sa_handler = signal_handler;
if (sigaction(SIGINT, &sa, NULL))
err(1, "sigaction");
+ if (sigaction(SIGTERM, &sa, NULL))
+ err(1, "sigaction");
rules_setup(fd);