Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/elfmz/far2l.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelfmz <fenix1905@tut.by>2022-04-04 00:42:26 +0300
committerelfmz <fenix1905@tut.by>2022-04-04 00:42:26 +0300
commit694878351f8201fa8682e68110ebef1cd9f5ad4b (patch)
tree876ca9046ec4e214230a16d2ceb0a566e47c1086 /far2l/src/base
parenta4b9ce9ae1f916ff501a553293983dc57540a47b (diff)
dont use backtrace with MUSL libc (touch #1285)
Diffstat (limited to 'far2l/src/base')
-rw-r--r--far2l/src/base/SafeMMap.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/far2l/src/base/SafeMMap.cpp b/far2l/src/base/SafeMMap.cpp
index 8d132a25..458d16bc 100644
--- a/far2l/src/base/SafeMMap.cpp
+++ b/far2l/src/base/SafeMMap.cpp
@@ -4,7 +4,12 @@
#include <signal.h>
#include <unistd.h>
#include <string.h>
-#include <execinfo.h>
+
+#if !defined(__FreeBSD__) && !defined(__MUSL__) // todo: pass to linker -lexecinfo under BSD and then may remove this ifndef
+# include <execinfo.h>
+# define HAS_BACKTRACE
+#endif
+
#include <fcntl.h>
#include <stdio.h>
#include "../WinPort/sudo.h"
@@ -118,7 +123,7 @@ static inline void WriteCrashSigLog(int num, siginfo_t *info, void *ctx)
FDScope fd(open(s_crash_log.c_str(), O_APPEND | O_CREAT | O_WRONLY, 0600));
if (fd.Valid()) {
FDWriteSignalInfo(fd, num, info, ctx);
-#ifndef __FreeBSD__ // todo: pass to linker -lexecinfo under BSD and then may remove this ifndef
+#ifdef HAS_BACKTRACE
// using backtrace/backtrace_symbols_fd is in general now allowed by signal safety rules
// but in general it works and its enough cuz other important info already written in
// signal-safe manner by FDWriteSignalInfo