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.
This commit is contained in:
Xavier Del Campo Romero 2024-01-20 01:09:18 +01:00
parent 43be8d95f6
commit 91ff743df9
Signed by: xavi
GPG Key ID: 84FF3612A9BF43F2

View File

@ -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)
{