Skip to content

Commit 446df60

Browse files
jeffhostetlergitster
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]> Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b7bd9a7 commit 446df60

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

compat/mingw.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2119,8 +2119,33 @@ int mingw_raise(int sig)
21192119
sigint_fn(SIGINT);
21202120
return 0;
21212121

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

0 commit comments

Comments
 (0)