sacc

sacc (saccomys): simple gopher client.
Log | Files | Refs | LICENSE

commit cc38aec276d50a961061d8cb288c8a5e50eed3ac
parent 16ab639d2e55e741c2e7028057a2f55876ad3db5
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:
sacc.c | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/sacc.c b/sacc.c @@ -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); } }