Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main: use HAVE_SIGNAL in init.c #881

Merged
merged 1 commit into from
Jul 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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