commit 2bfb783972ed195bed9a665eaf39a1da009774d7
parent 50e5ea790350d784231d9b4a8332ee9b3cb39d6b
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 9 Sep 2020 00:00:34 +0200
handle SIGTERM with higher priority while multiple signals are not processed
To reproduce (in this order):
* Open content with sfeed_content (p).
* pkill -SIGTERM sfeed_curses
* pkill -SIGHUP sfeed_curses
Previous behaviour:
The last signal was handled (SIGHUP) and SIGTERM was ignored.
New behaviour:
SIGTERM is treated as more important and is not ignored. SIGHUP is not handled
at all and the program is terminated.
Note that SIGINT is not treated with higher priority. This is intentional.
Note also that the commands (different order):
* pkill -SIGHUP sfeed_curses
* pkill -SIGTERM sfeed_curses
Will still ignore SIGHUP, this makes sense to me since the program is
terminated anyway.
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sfeed_curses.c b/sfeed_curses.c
@@ -1364,7 +1364,9 @@ sighandler(int signo)
case SIGINT:
case SIGTERM:
case SIGWINCH:
- sigstate = signo;
+ /* SIGTERM is more important, do not override it */
+ if (sigstate != SIGTERM)
+ sigstate = signo;
break;
}
}
@@ -2000,7 +2002,6 @@ event:
else if (ch == -3 && sigstate == 0)
continue; /* just a time-out, nothing to do */
- /* handle last signal */
switch (sigstate) {
case SIGHUP:
feeds_reloadall();