sfeed_curses

[fork] sfeed (atom feed) reader
Log | Files | Refs | README | LICENSE

commit 23a4a0206a80125a0793f5ae1744e13386d9ebe1
parent cc13f8869bee136ac7fca51628fc54de13d347e8
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Wed,  1 Jul 2020 18:49:51 +0200

try to cleanup nicely on SIGTERM and SIGINT

Diffstat:
Msfeed_curses.c | 13++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/sfeed_curses.c b/sfeed_curses.c @@ -427,8 +427,9 @@ init(void) sigemptyset(&sa.sa_mask); sa.sa_flags = SA_RESTART; /* require BSD signal semantics */ sa.sa_handler = sighandler; - if (sigaction(SIGWINCH, &sa, NULL) == -1) - err(1, "sigaction: SIGWINCH"); + sigaction(SIGINT, &sa, NULL); + sigaction(SIGTERM, &sa, NULL); + sigaction(SIGWINCH, &sa, NULL); needcleanup = 1; } @@ -1125,10 +1126,16 @@ updatesidebar(int onlynew) void sighandler(int signo) { - if (signo == SIGWINCH) { + switch (signo) { + case SIGINT: + case SIGTERM: + exit(signo); + break; + case SIGWINCH: getwinsize(); updategeom(); draw(); + break; } }