Turn off backtrace unless enabled with cmake (issue #550)
This commit is contained in:
13
src/tint.c
13
src/tint.c
@@ -220,6 +220,7 @@ const char *get_home_dir()
|
|||||||
|
|
||||||
void dump_backtrace(int log_fd)
|
void dump_backtrace(int log_fd)
|
||||||
{
|
{
|
||||||
|
#ifndef DISABLE_BACKTRACE
|
||||||
log_string(log_fd, "\n" YELLOW "Backtrace:" RESET "\n");
|
log_string(log_fd, "\n" YELLOW "Backtrace:" RESET "\n");
|
||||||
|
|
||||||
#ifdef ENABLE_LIBUNWIND
|
#ifdef ENABLE_LIBUNWIND
|
||||||
@@ -249,12 +250,9 @@ void dump_backtrace(int log_fd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
free(strings);
|
free(strings);
|
||||||
#else
|
#endif // ENABLE_EXECINFO
|
||||||
#ifdef DISABLE_BACKTRACE
|
#endif // ENABLE_LIBUNWIND
|
||||||
log_string(log_fd, "Backtrace support disabled at compile time.\n");
|
#endif // DISABLE_BACKTRACE
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// sleep() returns early when signals arrive. This function does not.
|
// sleep() returns early when signals arrive. This function does not.
|
||||||
@@ -271,7 +269,7 @@ void safe_sleep(int seconds)
|
|||||||
|
|
||||||
void handle_crash(const char *reason)
|
void handle_crash(const char *reason)
|
||||||
{
|
{
|
||||||
// We are going to crash, so restart the panel
|
#ifndef DISABLE_BACKTRACE
|
||||||
char path[4096];
|
char path[4096];
|
||||||
sprintf(path, "%s/.tint2-crash.log", get_home_dir());
|
sprintf(path, "%s/.tint2-crash.log", get_home_dir());
|
||||||
int log_fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0600);
|
int log_fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0600);
|
||||||
@@ -281,6 +279,7 @@ void handle_crash(const char *reason)
|
|||||||
dump_backtrace(log_fd);
|
dump_backtrace(log_fd);
|
||||||
log_string(log_fd, RED "Please create a bug report with this log output." RESET "\n");
|
log_string(log_fd, RED "Please create a bug report with this log output." RESET "\n");
|
||||||
close(log_fd);
|
close(log_fd);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BACKTRACE_ON_SIGNAL
|
#ifdef BACKTRACE_ON_SIGNAL
|
||||||
|
|||||||
Reference in New Issue
Block a user