aboutsummaryrefslogtreecommitdiffstats
path: root/common/log.c
diff options
context:
space:
mode:
authorLibravatar robotanarchy <robotanarchy@bingo-ev.de>2015-12-21 19:01:17 +0100
committerLibravatar robotanarchy <robotanarchy@bingo-ev.de>2015-12-21 19:01:17 +0100
commit94cac7a0149a8c1c48f33b0a8140edec5581ce64 (patch)
tree285f92b207907fe8876a749c079ed56f6a3c7373 /common/log.c
parentremove unused execinfo.h include from debug_log.c (diff)
downloadsway-94cac7a0149a8c1c48f33b0a8140edec5581ce64.tar.gz
sway-94cac7a0149a8c1c48f33b0a8140edec5581ce64.tar.zst
sway-94cac7a0149a8c1c48f33b0a8140edec5581ce64.zip
use CMake's FindBacktrace for backtrace feature detection
Diffstat (limited to 'common/log.c')
-rw-r--r--common/log.c5
1 files changed, 4 insertions, 1 deletions
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 @@
10#include <errno.h> 10#include <errno.h>
11#include <string.h> 11#include <string.h>
12#include <stringop.h> 12#include <stringop.h>
13#include <execinfo.h>
14 13
15int colored = 1; 14int colored = 1;
16log_importance_t loglevel_default = L_ERROR; 15log_importance_t loglevel_default = L_ERROR;
@@ -137,6 +136,7 @@ bool _sway_assert(bool condition, const char* format, ...) {
137} 136}
138 137
139void error_handler(int sig) { 138void error_handler(int sig) {
139#if SWAY_Backtrace_FOUND
140 int i; 140 int i;
141 int max_lines = 20; 141 int max_lines = 20;
142 void *array[max_lines]; 142 void *array[max_lines];
@@ -155,5 +155,8 @@ void error_handler(int sig) {
155 for (i = 0; (size_t)i < bt_len; i++) { 155 for (i = 0; (size_t)i < bt_len; i++) {
156 sway_log(L_ERROR, "Backtrace: %s", bt[i]); 156 sway_log(L_ERROR, "Backtrace: %s", bt[i]);
157 } 157 }
158#else
159 sway_log(L_ERROR, "Error: Signal %d.", sig);
160#endif
158 exit(1); 161 exit(1);
159} 162}