From f0056d041bd890dff8757a3472dd5fa9a1066405 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 2 Sep 2010 12:06:58 -0400 Subject: [PATCH] Declare signal handler function as "__cdecl" on Windows. I swear, they must have half a dozen different calling conventions. (goes to check) Holy crud. They actually do. There's __cdecl, __stdcall, __fastcall, "thiscall", "naked" and the obsolete "__pascal", "__fortran", and "__syscall". And don't forget WINAPI and __far. Anyways, this should fix 3044488 if I got it right. --- signal.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/signal.c b/signal.c index 1954223d..d39514ff 100644 --- a/signal.c +++ b/signal.c @@ -62,6 +62,12 @@ #include "log-internal.h" #include "evmap-internal.h" +#ifndef WIN32 +/* Windows wants us to call our signal handlers as __cdecl. Nobody else + * expects you to do anything crazy like this. */ +#define __cdecl +#endif + static int evsig_add(struct event_base *, int, short, short, void *); static int evsig_del(struct event_base *, int, short, short, void *); @@ -77,7 +83,7 @@ static const struct eventop evsigops = { struct event_base *evsig_base = NULL; -static void evsig_handler(int sig); +static void __cdecl evsig_handler(int sig); /* Callback for when the signal handler write a byte to our signaling socket */ static void @@ -141,7 +147,7 @@ evsig_init(struct event_base *base) * we can restore the original handler when we clear the current one. */ int _evsig_set_handler(struct event_base *base, - int evsignal, void (*handler)(int)) + int evsignal, void (*__cdecl handler)(int)) { #ifdef _EVENT_HAVE_SIGACTION struct sigaction sa; @@ -270,7 +276,7 @@ evsig_del(struct event_base *base, int evsignal, short old, short events, void * return (_evsig_restore_handler(base, evsignal)); } -static void +static void __cdecl evsig_handler(int sig) { int save_errno = errno; -- 2.40.0