commit 62d746cb6d34ed43068386bcd4a75f828055ee5e Hiltjo Posthuma <hiltjo@codemadness.org> 2020-07-02 23:24:53 +0200 exit with 128 + signo on receiving SIGHUP, SIGINT, SIGTERM This also makes a better distinction between SIGHUP (=1) and die(), which is also 1.
sacc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/sacc.c b/sacc.c index d86dce7..a58410a 100644 --- a/sacc.c +++ b/sacc.c @@ -951,6 +951,12 @@ cleanup(void) uicleanup(); } +void +sighandler(int signo) +{ + exit(128 + signo); +} + static void setup(void) { @@ -971,7 +977,7 @@ setup(void) sigemptyset(&sa.sa_mask); sa.sa_flags = SA_RESTART; - sa.sa_handler = exit; + sa.sa_handler = sighandler; sigaction(SIGINT, &sa, NULL); sigaction(SIGHUP, &sa, NULL); sigaction(SIGTERM, &sa, NULL);