commit 28b5f06b392a67e148367565a35530594179319e
parent c06074d5e48dee07a1cdc12917b5e8b091b69d1c
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 3 Jul 2020 12:54:22 +0200
remove atexit handling, just use cleanup() + _exit/exit
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/sfeed_curses.c b/sfeed_curses.c
@@ -137,6 +137,7 @@ static int lazyload = 0;
static char *plumber = "xdg-open"; /* environment variable: $SFEED_PLUMBER */
static char *piper = "less"; /* environment variable: $SFEED_PIPER */
+/* like BSD err(), but calls cleanup() and _exit(). */
void
err(int code, const char *fmt, ...)
{
@@ -1118,7 +1119,8 @@ sighandler(int signo)
switch (signo) {
case SIGINT:
case SIGTERM:
- exit(signo);
+ cleanup();
+ _exit(128 + signo);
break;
case SIGWINCH:
getwinsize();
@@ -1427,8 +1429,6 @@ main(int argc, char *argv[])
updatesidebar(onlynew);
init();
- atexit(cleanup);
-
draw();
while ((ch = readch()) != EOF) {
@@ -1639,5 +1639,7 @@ nextpage:
draw();
}
end:
+ cleanup();
+
return 0;
}