From c8917395c0cc5ff9fbec3a504c1855d9012d17ed Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 17 Jul 2016 11:29:29 -0400 Subject: [PATCH] Remove SIGSERV and SIGABORT handler From now on let's just let the core dumps happen and ask users to provide them. --- common/log.c | 47 +---------------------------------------------- 1 file changed, 1 insertion(+), 46 deletions(-) diff --git a/common/log.c b/common/log.c index 56c3834ab..6f9fb07ea 100644 --- a/common/log.c +++ b/common/log.c @@ -30,8 +30,6 @@ void init_log(log_importance_t verbosity) { loglevel_default = verbosity; } v = verbosity; - signal(SIGSEGV, error_handler); - signal(SIGABRT, error_handler); } void set_log_level(log_importance_t verbosity) { @@ -39,7 +37,7 @@ void set_log_level(log_importance_t verbosity) { } log_importance_t get_log_level(void) { - return v; + return v; } void reset_log_level(void) { @@ -136,46 +134,3 @@ bool _sway_assert(bool condition, const char* format, ...) { return false; } - -void error_handler(int sig) { -#if SWAY_Backtrace_FOUND - int i; - int max_lines = 20; - void *array[max_lines]; - char **bt; - size_t bt_len; - char maps_file[256]; - char maps_buffer[1024]; - - sway_log(L_ERROR, "Error: Signal %d. Printing backtrace", sig); - bt_len = backtrace(array, max_lines); - bt = backtrace_symbols(array, bt_len); - if (!bt) { - sway_log(L_ERROR, "Could not allocate sufficient memory for backtrace_symbols(), falling back to stderr"); - backtrace_symbols_fd(array, bt_len, STDERR_FILENO); - exit(1); - } - - for (i = 0; (size_t)i < bt_len; i++) { - sway_log(L_ERROR, "Backtrace: %s", bt[i]); - } - - sway_log(L_ERROR, "Maps:"); - pid_t pid = getpid(); - if (snprintf(maps_file, 255, "/proc/%zd/maps", (size_t)pid) < 255) { - FILE *maps = fopen(maps_file, "r"); - while (!feof(maps)) { - char *m = read_line_buffer(maps, maps_buffer, 1024); - if (!m) { - sway_log(L_ERROR, "Unable to allocate memory to show maps"); - break; - } - sway_log(L_ERROR, "%s", m); - } - fclose(maps); - } -#else - sway_log(L_ERROR, "Error: Signal %d.", sig); -#endif - exit(1); -}