-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
tests/server: make the signal handler signal-safe #16852
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This reverts commit 6784601. All MSVC.
This caused no error, but it's incorrect and introduced a potential difference to builds without `STDERR_FILENO`, which in practice means MSVC. The macro's only use needs to use `stderr` always. Follow-up to e5bb88b curl#11958
bagder
approved these changes
Mar 28, 2025
This reverts commit 35d8821. Same.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before this patch the signal handler called
logmsg()
which in turncalled
printf()
variants (internal implementations), andFILE *
functions,
localtime()
. Some of these calledmalloc
/free
, whichisn't supported in s signal handler. Replace them with
write
calls,losing some logging functionality.
Also:
STD*_FILENO
macros tolib/curl_setup.h
. Revertthe
src
definition to point tostderr
, instead oftool_stderr
.Follow-up to e5bb88b tool: use our own stderr variable #11958
POSIX specs with list of functions allowed in a signal handler:
2004: https://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html#tag_02_04_03
2017: https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04_03
2024: https://pubs.opengroup.org/onlinepubs/9799919799/functions/V2_chap02.html#tag_16_04_03
Linux CI run with the thread sanitizer going crazy when
hitting the signal handler in test 1238 and 1242 (TFTP):
Ref: https://github.com/curl/curl/actions/runs/14118903372/job/39555309490?pr=16851