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> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff Hostetler committed Jun 25, 2019 at 07:49 UTC 446df60367be5f3a97f7bac12071878d1fdbebd2
1 file changed +25
compat/mingw.c
+25
@@ -2119,8 +2119,33 @@ int mingw_raise(int sig)
2119 sigint_fn(SIGINT);
2120 return 0;
2121
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 +
2144 default:
2145 return raise(sig);
2146 +
2147 +#endif
2148 +
2149 }
2150 }
2151