From 133785b15936d9417fdc41f77b87304b6bf458d5 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 5 Aug 2026 19:10:52 +0200 Subject: [PATCH] servers: drop re-registering the signal handler on modern systems Before this patch modern systems used `sigaction()` and `SA_RESTART` to install signal handlers, but the signal handler function itself still made a call to the legacy `signal()` function to re-register itself before returning. Re-registering the handler is not necessary with `sigaction()`. It's also undesired to use the legacy API when the modern one is available. Fix by guarding off this call in builds that support the modern API. Follow-up to 3fb6e5a01001b8c7dfdc33a89041178aac381a27 #6529 Follow-up to 18cbb4d7d645016d1a9c0ee772c724d8c41db3bd Closes #22497 --- tests/server/util.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/server/util.c b/tests/server/util.c index 819e3432dc..397484a594 100644 --- a/tests/server/util.c +++ b/tests/server/util.c @@ -415,7 +415,9 @@ static void exit_signal_handler(int signum) (void)SetEvent(exit_event); #endif } +#if !(defined(HAVE_SIGACTION) && defined(SA_RESTART)) (void)signal(signum, exit_signal_handler); +#endif errno = old_errno; } #if defined(CURL_HAVE_DIAG) && !defined(__clang__) -- 2.47.3