Skip to content

Commit 35131b3

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 c0958e9 commit 35131b3

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
@@ -2407,8 +2407,34 @@ int mingw_raise(int sig)
24072407
sigint_fn(SIGINT);
24082408
return 0;
24092409

2410+
#if defined(_MSC_VER)
2411+
/*
2412+
* <signal.h> in the CRT defines 8 signals as being
2413+
* supported on the platform. Anything else causes
2414+
* an "Invalid signal or error" (which in DEBUG builds
2415+
* causes the Abort/Retry/Ignore dialog). We by-pass
2416+
* the CRT for things we already know will fail.
2417+
*/
2418+
/*case SIGINT:*/
2419+
case SIGILL:
2420+
case SIGFPE:
2421+
case SIGSEGV:
2422+
case SIGTERM:
2423+
case SIGBREAK:
2424+
case SIGABRT:
2425+
case SIGABRT_COMPAT:
2426+
return raise(sig);
2427+
default:
2428+
errno = EINVAL;
2429+
return -1;
2430+
2431+
#else
2432+
24102433
default:
24112434
return raise(sig);
2435+
2436+
#endif
2437+
24122438
}
24132439
}
24142440

0 commit comments

Comments
 (0)