Skip to content

Commit 2f9bc76

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 99e348e commit 2f9bc76

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
@@ -2450,8 +2450,34 @@ int mingw_raise(int sig)
24502450
sigint_fn(SIGINT);
24512451
return 0;
24522452

2453+
#if defined(_MSC_VER)
2454+
/*
2455+
* <signal.h> in the CRT defines 8 signals as being
2456+
* supported on the platform. Anything else causes
2457+
* an "Invalid signal or error" (which in DEBUG builds
2458+
* causes the Abort/Retry/Ignore dialog). We by-pass
2459+
* the CRT for things we already know will fail.
2460+
*/
2461+
/*case SIGINT:*/
2462+
case SIGILL:
2463+
case SIGFPE:
2464+
case SIGSEGV:
2465+
case SIGTERM:
2466+
case SIGBREAK:
2467+
case SIGABRT:
2468+
case SIGABRT_COMPAT:
2469+
return raise(sig);
2470+
default:
2471+
errno = EINVAL;
2472+
return -1;
2473+
2474+
#else
2475+
24532476
default:
24542477
return raise(sig);
2478+
2479+
#endif
2480+
24552481
}
24562482
}
24572483

0 commit comments

Comments
 (0)