Browse Source

Fix signal name in fatalSignalHandler on Linux.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
87f1b868f9
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      adapters/standalone.cpp

+ 7
- 1
adapters/standalone.cpp View File

@@ -28,6 +28,7 @@
#include <thread> #include <thread>
#include <unistd.h> // for getopt #include <unistd.h> // for getopt
#include <signal.h> // for signal #include <signal.h> // for signal
#include <string.h> // for sys_siglist
#if defined ARCH_WIN #if defined ARCH_WIN
#include <windows.h> // for CreateMutex #include <windows.h> // for CreateMutex
#endif #endif
@@ -47,7 +48,12 @@ static void fatalSignalHandler(int sig) {
// Ignore abort() since we call it below. // Ignore abort() since we call it below.
signal(SIGABRT, NULL); signal(SIGABRT, NULL);


std::string sigName = "SIG" + string::uppercase(sys_signame[sig]);
#if defined ARCH_LIN
const char* sigNameC = strsignal(sig);
#else
const char* sigNameC = sys_siglist[sig];
#endif
std::string sigName = "SIG" + string::uppercase(sigNameC);
std::string stackTrace = system::getStackTrace(); std::string stackTrace = system::getStackTrace();
FATAL("Fatal signal %d %s. Stack trace:\n%s", sig, sigName.c_str(), stackTrace.c_str()); FATAL("Fatal signal %d %s. Stack trace:\n%s", sig, sigName.c_str(), stackTrace.c_str());




Loading…
Cancel
Save