From 1feeca65ce23aaf6646c2d29820012ef23406144 Mon Sep 17 00:00:00 2001 From: Snaipe Date: Tue, 4 Aug 2015 15:18:39 +0200 Subject: [PATCH] Fixed signal handling on windows --- samples/signal.c | 5 +++-- src/posix-compat.c | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/samples/signal.c b/samples/signal.c index 1cda5d9..9dcc99d 100644 --- a/samples/signal.c +++ b/samples/signal.c @@ -8,8 +8,9 @@ Test(simple, caught, .signal = SIGSEGV) { *i = 42; } -Test(simple, wrong_signal, .signal = SIGSEGV) { - raise(SIGINT); +Test(simple, wrong_signal, .signal = SIGINT) { + int *i = NULL; + *i = 42; } Test(simple, uncaught) { diff --git a/src/posix-compat.c b/src/posix-compat.c index 108fe71..72afb91 100644 --- a/src/posix-compat.c +++ b/src/posix-compat.c @@ -28,6 +28,11 @@ # define WRITE_PROCESS_(Proc, What, Size) \ WriteProcessMemory(Proc, &What, &What, Size, NULL); +# include +# ifndef SIGALRM +# define SIGALRM 14 +# endif + #else # include # include @@ -191,7 +196,7 @@ void wait_process(s_proc_handle *handle, int *status) { GetExitCodeProcess(handle->handle, &exit_code); CloseHandle(handle->handle); - int sig = 0; + unsigned int sig = 0; switch (exit_code) { case STATUS_FLOAT_DENORMAL_OPERAND: case STATUS_FLOAT_DIVIDE_BY_ZERO: