Skip to content

Commit b2d6eb9

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 <jeffhost@microsoft.com>
1 parent 813abad commit b2d6eb9

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
@@ -2076,8 +2076,34 @@ int mingw_raise(int sig)
20762076
sigint_fn(SIGINT);
20772077
return 0;
20782078

2079+
#if defined(_MSC_VER)
2080+
/*
2081+
* <signal.h> in the CRT defines 8 signals as being
2082+
* supported on the platform. Anything else causes
2083+
* an "Invalid signal or error" (which in DEBUG builds
2084+
* causes the Abort/Retry/Ignore dialog). We by-pass
2085+
* the CRT for things we already know will fail.
2086+
*/
2087+
/*case SIGINT:*/
2088+
case SIGILL:
2089+
case SIGFPE:
2090+
case SIGSEGV:
2091+
case SIGTERM:
2092+
case SIGBREAK:
2093+
case SIGABRT:
2094+
case SIGABRT_COMPAT:
2095+
return raise(sig);
2096+
default:
2097+
errno = EINVAL;
2098+
return -1;
2099+
2100+
#else
2101+
20792102
default:
20802103
return raise(sig);
2104+
2105+
#endif
2106+
20812107
}
20822108
}
20832109

0 commit comments

Comments
 (0)