Skip to content

Commit

Permalink
main/init: enable win32 signal handler (#779)
Browse files Browse the repository at this point in the history
  • Loading branch information
sreimers authored May 2, 2023
1 parent 64e5843 commit 394b3c5
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/main/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
* Copyright (C) 2010 Creytiv.com
*/
#include <stdlib.h>
#ifdef HAVE_SIGNAL
#include <signal.h>
#endif
#ifdef WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
Expand All @@ -26,7 +24,6 @@
static bool exception_btrace = false;


#ifdef HAVE_SIGNAL
static void signal_handler(int sig)
{
struct btrace bt;
Expand All @@ -41,7 +38,6 @@ static void signal_handler(int sig)

exit(128 + sig);
}
#endif


#ifdef WIN32
Expand Down Expand Up @@ -145,17 +141,14 @@ int libre_init(void)
{
int err;

#if defined(HAVE_SIGNAL)
if (exception_btrace) {
(void)signal(SIGSEGV, signal_handler);
(void)signal(SIGABRT, signal_handler);
(void)signal(SIGILL, signal_handler);
}
#elif defined(WIN32)
if (exception_btrace) {
#ifdef WIN32
SetUnhandledExceptionFilter(exception_handler);
}
#endif
}

#ifdef USE_OPENSSL
err = openssl_init();
Expand Down

0 comments on commit 394b3c5

Please sign in to comment.