]> git.ipfire.org Git - thirdparty/curl.git/commit
servers: fix to reverse `SA_RESTART` option for `sigaction()` on modern codepath master
authorViktor Szakats <commit@vsz.me>
Tue, 16 Jun 2026 01:07:58 +0000 (03:07 +0200)
committerViktor Szakats <commit@vsz.me>
Tue, 4 Aug 2026 15:36:14 +0000 (17:36 +0200)
commit69e8278149ce5e476bf4020b52e3928ec9dbf095
tree2cd028d1e48301aa071e846e082c9b5634959079
parent2112f185c0d906e02939048e24a85f60a8671327
servers: fix to reverse `SA_RESTART` option for `sigaction()` on modern codepath

Historically servers used the deprecated `siginterrupt()` function to
configure restart behavior on specific signals. It accepts a flag, where
1 means to remove the `SA_RESTART` option, and 0 means to enable it.

In year 2021 3fb6e5a01001b8c7dfdc33a89041178aac381a27 introduced the
modern alternative to the codebase, replacing `siginterrupt()` with
`sigaction()`. After this patch, supporting, modern, systems reacted on
the same flag, but, by accident, set the `SA_RESTART` bit when flag is
1, and did not set it when 0. This reversed the previous behavior, and
the one still used on the `siginterrupt()` legacy codepath.

Fix it by revesring the `SA_RESTART` logic for the `sigaction()`
codepath, syncing it with the pre-existing behavior.

I find it odd this did not cause any perceivable issue for 5 years, even
though it's the active one in most Unix envs.

Spotted by GitHub Code Quality, though suggesting to fix
`siginterrupt()` calls. But looking into the history, those were correct
all along.

Refs:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/siginterrupt.html
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaction.html
https://www.man7.org/linux/man-pages/man3/siginterrupt.3.html
https://www.man7.org/linux/man-pages/man2/sigaction.2.html

Follow-up to 3fb6e5a01001b8c7dfdc33a89041178aac381a27 #6529

Closes #22037
tests/server/util.c