From 94cac7a0149a8c1c48f33b0a8140edec5581ce64 Mon Sep 17 00:00:00 2001 From: robotanarchy Date: Mon, 21 Dec 2015 19:01:17 +0100 Subject: use CMake's FindBacktrace for backtrace feature detection --- common/CMakeLists.txt | 1 + common/log.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index a40f096d..95617e15 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -1,4 +1,5 @@ add_library(sway-common + ${SWAY_Backtrace_HEADER} ipc-client.c list.c log.c diff --git a/common/log.c b/common/log.c index 02aac4c1..f9242bf4 100644 --- a/common/log.c +++ b/common/log.c @@ -10,7 +10,6 @@ #include #include #include -#include int colored = 1; log_importance_t loglevel_default = L_ERROR; @@ -137,6 +136,7 @@ bool _sway_assert(bool condition, const char* format, ...) { } void error_handler(int sig) { +#if SWAY_Backtrace_FOUND int i; int max_lines = 20; void *array[max_lines]; @@ -155,5 +155,8 @@ void error_handler(int sig) { for (i = 0; (size_t)i < bt_len; i++) { sway_log(L_ERROR, "Backtrace: %s", bt[i]); } +#else + sway_log(L_ERROR, "Error: Signal %d.", sig); +#endif exit(1); } -- cgit v1.2.3-70-g09d2