Handle SIGHUP and SIGTERM - sacc - sacc(omys), simple console gopher client | |
git clone git://bitreich.org/sacc/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65… | |
Log | |
Files | |
Refs | |
Tags | |
LICENSE | |
--- | |
commit 18a92be39ac2fea50ce2d63c7a03ad64528eb843 | |
parent ed63d85224f39fc733d55b0d326085d7f4bd0b70 | |
Author: Stefan Hagen <[email protected]> | |
Date: Fri, 16 Nov 2018 22:24:06 +0100 | |
Handle SIGHUP and SIGTERM | |
Killing a terminal where sacc is running will send SIGHUP to sacc. | |
With this patch, sacc is handling SIGHUP and SIGTERM and cleans up | |
temporary files properly. | |
Diffstat: | |
M sacc.c | 2 ++ | |
1 file changed, 2 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/sacc.c b/sacc.c | |
@@ -958,6 +958,8 @@ setup(void) | |
sa.sa_flags = SA_RESTART; | |
sa.sa_handler = exit; | |
sigaction(SIGINT, &sa, NULL); | |
+ sigaction(SIGHUP, &sa, NULL); | |
+ sigaction(SIGTERM, &sa, NULL); | |
if (mkdir(tmpdir, S_IRWXU) < 0 && errno != EEXIST) | |
die("mkdir: %s: %s", tmpdir, strerror(errno)); |