Skip to content

Commit e04c4b7

Browse files
jeffhostetlerdscho
authored andcommitted
msvc: do not pretend to support all signals
This special-cases various signals that are not supported on Windows, such as SIGPIPE. These cause the UCRT to throw asserts (at least in debug mode). Signed-off-by: Jeff Hostetler <[email protected]>
1 parent cb436c3 commit e04c4b7

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

compat/mingw.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2291,8 +2291,34 @@ int mingw_raise(int sig)
22912291
sigint_fn(SIGINT);
22922292
return 0;
22932293

2294+
#if defined(_MSC_VER)
2295+
/*
2296+
* <signal.h> in the CRT defines 8 signals as being
2297+
* supported on the platform. Anything else causes
2298+
* an "Invalid signal or error" (which in DEBUG builds
2299+
* causes the Abort/Retry/Ignore dialog). We by-pass
2300+
* the CRT for things we already know will fail.
2301+
*/
2302+
/*case SIGINT:*/
2303+
case SIGILL:
2304+
case SIGFPE:
2305+
case SIGSEGV:
2306+
case SIGTERM:
2307+
case SIGBREAK:
2308+
case SIGABRT:
2309+
case SIGABRT_COMPAT:
2310+
return raise(sig);
2311+
default:
2312+
errno = EINVAL;
2313+
return -1;
2314+
2315+
#else
2316+
22942317
default:
22952318
return raise(sig);
2319+
2320+
#endif
2321+
22962322
}
22972323
}
22982324

0 commit comments

Comments
 (0)