From 7ba68130937bae642c32aa655a550ad8543990f1 Mon Sep 17 00:00:00 2001 From: jca Date: Thu, 2 Jun 2022 21:38:46 +0000 Subject: [PATCH] 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@ --- usr.sbin/btrace/btrace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 @@ -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); -- 2.20.1