commit ffcfc144df95d8871558098969b33b37d7488564
parent f2b48c669ee5b69e3b46f64979739d15f41338c2
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Thu, 2 Jul 2020 23:24:53 +0200
exit with 128 + igno on receiving SIGHUP, SIGINT, SIGTERM
This also makes a better distinction between SIGHUP (=1) and die(), which is
also 1.
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git 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);