[PATCH v3 18/20] msvc: do not pretend to support all signals
- From
- Jeff Hostetler via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Jun 25, 2019, 14:49 UTC
- Message-ID
- <c9a6f6892c5ff0f24da0464895865eeea1240f42.1561474167.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.149.v3.git.gitgitgadget@gmail.com>
From: Jeff Hostetler <jeffhost@microsoft.com>
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> --- compat/mingw.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
diff --git a/compat/mingw.c b/compat/mingw.c index 667285887a..d01e88c2f8 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -2119,8 +2119,33 @@ int mingw_raise(int sig) sigint_fn(SIGINT); return 0; +#if defined(_MSC_VER) + case SIGILL: + case SIGFPE: + case SIGSEGV: + case SIGTERM: + case SIGBREAK: + case SIGABRT: + case SIGABRT_COMPAT: + /* + * The <signal.h> header in the MS C Runtime defines 8 signals + * as being supported on the platform. Anything else causes an + * "Invalid signal or error" (which in DEBUG builds causes the + * Abort/Retry/Ignore dialog). We by-pass the CRT for things we + * already know will fail. + */ + return raise(sig); + default: + errno = EINVAL; + return -1; + +#else + default: return raise(sig); + +#endif + } }
-- gitgitgadget