Only include execinfo.h when glibc is used

This commit is contained in:
Leon Henrik Plickat 2021-11-26 13:51:46 +01:00
parent c61cbb4573
commit 06ae5c5f6e

View File

@ -28,8 +28,11 @@
#include <wayland-client.h>
#ifdef __linux__
#include <features.h>
#ifdef __GLIBC__
#include<execinfo.h>
#endif
#endif
#include "xdg-output-unstable-v1.h"
#include "wlr-output-power-management-unstable-v1.h"
@ -432,6 +435,7 @@ static void handle_error (int signum)
fputs(msg, stderr);
#ifdef __linux__
#ifdef __GLIBC__
fputs("Attempting to get backtrace:\n", stderr);
/* In some rare cases, getting a backtrace can also cause a segfault.
@ -442,6 +446,7 @@ static void handle_error (int signum)
const int calls = backtrace(buffer, sizeof(buffer) / sizeof(void *));
backtrace_symbols_fd(buffer, calls, fileno(stderr));
fputs("\n", stderr);
#endif
#endif
/* Let the default handlers deal with the rest. */