Skip to content

Commit 69120db

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 fa2c472 commit 69120db

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
@@ -2138,8 +2138,34 @@ int mingw_raise(int sig)
21382138
sigint_fn(SIGINT);
21392139
return 0;
21402140

2141+
#if defined(_MSC_VER)
2142+
/*
2143+
* <signal.h> in the CRT defines 8 signals as being
2144+
* supported on the platform. Anything else causes
2145+
* an "Invalid signal or error" (which in DEBUG builds
2146+
* causes the Abort/Retry/Ignore dialog). We by-pass
2147+
* the CRT for things we already know will fail.
2148+
*/
2149+
/*case SIGINT:*/
2150+
case SIGILL:
2151+
case SIGFPE:
2152+
case SIGSEGV:
2153+
case SIGTERM:
2154+
case SIGBREAK:
2155+
case SIGABRT:
2156+
case SIGABRT_COMPAT:
2157+
return raise(sig);
2158+
default:
2159+
errno = EINVAL;
2160+
return -1;
2161+
2162+
#else
2163+
21412164
default:
21422165
return raise(sig);
2166+
2167+
#endif
2168+
21432169
}
21442170
}
21452171

0 commit comments

Comments
 (0)