Turns out the signal handler on Windows still wasn't signal safe after
the previous round of fix. There is an `open()` call made from there,
and `open` happens to be unconditionally overridden via `curl_setup.h`
on Windows, to its local implementation (`curlx_win32_open()`), which
does memory allocations and potentially other things that are not signal
safe.
This is a temporary fix, till avoiding the override of system symbols
`open` and `stat` on Windows.
FTR this did not fix the CI 2304 errors, diskspace fail or job hangs due
to 0xC0000142 fork failure (it's rare all three occurs in the same run):
https://github.com/curl/curl/actions/runs/
18110523584?pr=18774
Ref: #18634
Follow-up
e95f509c66abdd88ae02e3243cdc217f19c4a330 #16852
Closes #18774
(void)!write(STDERR_FILENO, msg, sizeof(msg) - 1);
}
else {
+ int fd;
#ifdef _WIN32
-#define OPENMODE S_IREAD | S_IWRITE
+ fd = _open(serverlogfile, O_WRONLY|O_CREAT|O_APPEND, S_IREAD | S_IWRITE);
#else
-#define OPENMODE S_IRUSR | S_IWUSR
+ fd = open(serverlogfile, O_WRONLY|O_CREAT|O_APPEND, S_IRUSR | S_IWUSR);
#endif
- int fd = open(serverlogfile, O_WRONLY|O_CREAT|O_APPEND, OPENMODE);
if(fd != -1) {
static const char msg[] = "exit_signal_handler: called\n";
(void)!write(fd, msg, sizeof(msg) - 1);