Skip to content

Commit f4775ac

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 545c641 commit f4775ac

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
@@ -2282,8 +2282,34 @@ int mingw_raise(int sig)
22822282
sigint_fn(SIGINT);
22832283
return 0;
22842284

2285+
#if defined(_MSC_VER)
2286+
/*
2287+
* <signal.h> in the CRT defines 8 signals as being
2288+
* supported on the platform. Anything else causes
2289+
* an "Invalid signal or error" (which in DEBUG builds
2290+
* causes the Abort/Retry/Ignore dialog). We by-pass
2291+
* the CRT for things we already know will fail.
2292+
*/
2293+
/*case SIGINT:*/
2294+
case SIGILL:
2295+
case SIGFPE:
2296+
case SIGSEGV:
2297+
case SIGTERM:
2298+
case SIGBREAK:
2299+
case SIGABRT:
2300+
case SIGABRT_COMPAT:
2301+
return raise(sig);
2302+
default:
2303+
errno = EINVAL;
2304+
return -1;
2305+
2306+
#else
2307+
22852308
default:
22862309
return raise(sig);
2310+
2311+
#endif
2312+
22872313
}
22882314
}
22892315

0 commit comments

Comments
 (0)