{"author":"Viktor Szakats","author_email":"commit@vsz.me","author_time":1743122488,"commit_time":1743159758,"committer":"Viktor Szakats","committer_email":"commit@vsz.me","hash":"e95f509c66abdd88ae02e3243cdc217f19c4a330","message":"tests/server: make the signal handler signal-safe\n\nBefore this patch the signal handler called `logmsg()` which in turn\ncalled `printf()` variants (internal implementations), and `FILE *`\nfunctions, `localtime()`. Some of these called `malloc`/`free`, which\nisn't supported in s signal handler. Replace them with `write` calls,\nlosing some logging functionality.\n\nAlso:\n- De-dupe and move `STD*_FILENO` macros to `lib/curl_setup.h`. Revert\n  the `src` definition to point to `stderr`, instead of `tool_stderr`.\n  Follow-up to e5bb88b8f824ed87620bd923552534c83c2a516e #11958\n\nPOSIX specs with list of functions allowed in a signal handler:\n2004: https://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html#tag_02_04_03\n2017: https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04_03\n2024: https://pubs.opengroup.org/onlinepubs/9799919799/functions/V2_chap02.html#tag_16_04_03\n\nLinux CI run with the thread sanitizer going crazy when\nhitting the signal handler in test 1238 and 1242 (TFTP):\n```\nWARNING: ThreadSanitizer: signal-unsafe call inside of a signal (pid=12582)\n    #0 malloc <null> (servers+0x5ed70)\n    #1 _IO_file_doallocate <null> (libc.so.6+0x851b4)\n    #2 formatf /home/runner/work/curl/curl/bld/tests/server/../../lib/../../lib/mprintf.c:886:9 (servers+0xdff77)\n[...]\nWARNING: ThreadSanitizer: signal-unsafe call inside of a signal (pid=12582)\n    #0 free <null> (servers+0x5f453)\n    #1 fclose <null> (libc.so.6+0x8532f)\n    #2 logmsg /home/runner/work/curl/curl/bld/tests/server/../../../tests/server/util.c:134:5 (servers+0xe684d)\n```\nRef: https://github.com/curl/curl/actions/runs/14118903372/job/39555309490?pr=16851\n\nCloses #16852\n","parents":["3b6c7142f6e86dc575a97fb9c9f678e5e5e1db5c"],"tree_hash":"221ed1469227e5722fea62d2ee7326bf3b8d3b19"}