aboutsummaryrefslogtreecommitdiff
path: root/src/common/backtrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/backtrace.c')
-rw-r--r--src/common/backtrace.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/common/backtrace.c b/src/common/backtrace.c
index bed0442471..3b762b68e3 100644
--- a/src/common/backtrace.c
+++ b/src/common/backtrace.c
@@ -1,6 +1,18 @@
-/* Copyright (c) 2013-2015, The Tor Project, Inc. */
+/* Copyright (c) 2013-2016, The Tor Project, Inc. */
/* See LICENSE for licensing information */
+/**
+ * \file backtrace.c
+ *
+ * \brief Functions to produce backtraces on bugs, crashes, or assertion
+ * failures.
+ *
+ * Currently, we've only got an implementation here using the backtrace()
+ * family of functions, which are sometimes provided by libc and sometimes
+ * provided by libexecinfo. We tie into the sigaction() backend in order to
+ * detect crashes.
+ */
+
#define __USE_GNU
#define _GNU_SOURCE 1
@@ -215,9 +227,10 @@ int
configure_backtrace_handler(const char *tor_version)
{
tor_free(bt_version);
- if (!tor_version)
- tor_version = "";
- tor_asprintf(&bt_version, "Tor %s", tor_version);
+ if (tor_version)
+ tor_asprintf(&bt_version, "Tor %s", tor_version);
+ else
+ tor_asprintf(&bt_version, "Tor");
return install_bt_handler();
}