tExit gracefuly on SIGINT. - sacc - sacc(omys), simple console gopher client (mirror) HTML git clone https://git.parazyd.org/sacc DIR Log DIR Files DIR Refs DIR LICENSE --- DIR commit cc38aec276d50a961061d8cb288c8a5e50eed3ac DIR parent 16ab639d2e55e741c2e7028057a2f55876ad3db5 HTML Author: Quentin Rameau <quinq@fifth.space> Date: Sun, 25 Feb 2018 13:05:12 +0100 Exit gracefuly on SIGINT. Thanks to Mattwyrm for the suggestion! Diffstat: M sacc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- DIR diff --git a/sacc.c b/sacc.c t@@ -863,13 +863,17 @@ setup(void) close(fd); if ((devnullfd = open("/dev/null", O_WRONLY)) < 0) die("open: /dev/null: %s", strerror(errno)); + + sigemptyset(&sa.sa_mask); + sa.sa_flags = SA_RESTART; + sa.sa_handler = exit; + sigaction(SIGINT, &sa, NULL); + if (mkdir(tmpdir, S_IRWXU) < 0 && errno != EEXIST) die("mkdir: %s: %s", tmpdir, strerror(errno)); if(interactive = isatty(1)) { uisetup(); - sigemptyset(&sa.sa_mask); sa.sa_handler = uisigwinch; - sa.sa_flags = SA_RESTART; sigaction(SIGWINCH, &sa, NULL); } }