exit with 128 + signo on receiving SIGHUP, SIGINT, SIGTERM - sacc - sacc(omys), simple console gopher client HTML git clone git://bitreich.org/sacc/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/sacc/ DIR Log DIR Files DIR Refs DIR Tags DIR LICENSE --- DIR commit 62d746cb6d34ed43068386bcd4a75f828055ee5e DIR parent f2b48c669ee5b69e3b46f64979739d15f41338c2 HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Thu, 2 Jul 2020 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. Diffstat: M sacc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- DIR 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);