Skip to content

Commit f08f629

Browse files
jeffhostetlerGit for Windows Build Agent
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 4d3145c commit f08f629

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
@@ -2119,8 +2119,34 @@ int mingw_raise(int sig)
21192119
sigint_fn(SIGINT);
21202120
return 0;
21212121

2122+
#if defined(_MSC_VER)
2123+
/*
2124+
* <signal.h> in the CRT defines 8 signals as being
2125+
* supported on the platform. Anything else causes
2126+
* an "Invalid signal or error" (which in DEBUG builds
2127+
* causes the Abort/Retry/Ignore dialog). We by-pass
2128+
* the CRT for things we already know will fail.
2129+
*/
2130+
/*case SIGINT:*/
2131+
case SIGILL:
2132+
case SIGFPE:
2133+
case SIGSEGV:
2134+
case SIGTERM:
2135+
case SIGBREAK:
2136+
case SIGABRT:
2137+
case SIGABRT_COMPAT:
2138+
return raise(sig);
2139+
default:
2140+
errno = EINVAL;
2141+
return -1;
2142+
2143+
#else
2144+
21222145
default:
21232146
return raise(sig);
2147+
2148+
#endif
2149+
21242150
}
21252151
}
21262152

0 commit comments

Comments
 (0)