From 87f1b868f9a75d3ef5747bdd27ab93ddb69861da Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Tue, 16 Nov 2021 17:47:55 -0500 Subject: [PATCH] Fix signal name in fatalSignalHandler on Linux. --- adapters/standalone.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/adapters/standalone.cpp b/adapters/standalone.cpp index 16cfb6c8..035dcda5 100644 --- a/adapters/standalone.cpp +++ b/adapters/standalone.cpp @@ -28,6 +28,7 @@ #include #include // for getopt #include // for signal +#include // for sys_siglist #if defined ARCH_WIN #include // for CreateMutex #endif @@ -47,7 +48,12 @@ static void fatalSignalHandler(int sig) { // Ignore abort() since we call it below. 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(); FATAL("Fatal signal %d %s. Stack trace:\n%s", sig, sigName.c_str(), stackTrace.c_str());