aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2024-01-20 01:09:18 +0100
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2024-01-20 01:19:57 +0100
commit91ff743df9fcee048cb44dba0c7047df04454dd2 (patch)
tree1a862b3872c288c173933035ca35a3bd5d40eeb4
parent43be8d95f681c8240847b4f69a524a0ab20d5c83 (diff)
server.c: Fix wrong priority for do_exit
Under some specific circumstances, poll(2) would return a positive integer, but do_exit might had been previously set. This caused libweb to ignore SIGTERM, with the potential risk for an endless loop.
-rw-r--r--server.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/server.c b/server.c
index 3cff970..6167db3 100644
--- a/server.c
+++ b/server.c
@@ -230,13 +230,13 @@ again:
res = poll(fds, n, -1);
- if (res < 0)
+ if (do_exit)
+ {
+ *exit = true;
+ goto end;
+ }
+ else if (res < 0)
{
- if (do_exit)
- {
- *exit = true;
- goto end;
- }
switch (errno)
{