Skip to content

Commit

Permalink
main: use HAVE_SIGNAL in init.c
Browse files Browse the repository at this point in the history
  • Loading branch information
cspiel1 committed Jul 19, 2023
1 parent a856bb8 commit 2235831
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
* 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 @@ -24,6 +26,7 @@
static bool exception_btrace = false;


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


#ifdef WIN32
Expand Down Expand Up @@ -141,9 +145,11 @@ int libre_init(void)
int err;

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

0 comments on commit 2235831

Please sign in to comment.