aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-07-19 22:47:49 -0400
committerNick Mathewson <nickm@torproject.org>2013-11-18 10:43:15 -0500
commitbd8ad674b913582b6f8e5b85ac722e14598d681b (patch)
tree6833bbd938ce99a8d8c91bd8f6e53befdd149711 /src/or
parentb0023083c413c6447ef34cf3c6cfaf54a1cc8793 (diff)
downloadtor-bd8ad674b913582b6f8e5b85ac722e14598d681b.tar
tor-bd8ad674b913582b6f8e5b85ac722e14598d681b.tar.gz
Add a sighandler-safe logging mechanism
We had accidentially grown two fake ones: one for backtrace.c, and one for sandbox.c. Let's do this properly instead. Now, when we configure logs, we keep track of fds that should get told about bad stuff happening from signal handlers. There's another entry point for these that avoids using non-signal-handler-safe functions.
Diffstat (limited to 'src/or')
-rw-r--r--src/or/config.c16
-rw-r--r--src/or/main.c2
2 files changed, 2 insertions, 16 deletions
diff --git a/src/or/config.c b/src/or/config.c
index af5bf41d2..c62a25a7a 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -12,7 +12,6 @@
#define CONFIG_PRIVATE
#include "or.h"
#include "addressmap.h"
-#include "backtrace.h"
#include "channel.h"
#include "circuitbuild.h"
#include "circuitlist.h"
@@ -1114,19 +1113,6 @@ options_act_reversible(const or_options_t *old_options, char **msg)
/* No need to roll back, since you can't change the value. */
}
- /* Enable crash logging to files */
- {
- /* XXXX we might want to set this up earlier, if possible! */
- char *backtrace_fname = NULL;
- char *progname = NULL;
- tor_asprintf(&backtrace_fname, "%s"PATH_SEPARATOR"stack_dump",
- options->DataDirectory);
- tor_asprintf(&progname, "Tor %s", get_version());
- configure_backtrace_handler(backtrace_fname, progname);
- tor_free(backtrace_fname);
- tor_free(progname);
- }
-
/* Write control ports to disk as appropriate */
control_ports_write_to_file();
@@ -1156,7 +1142,7 @@ options_act_reversible(const or_options_t *old_options, char **msg)
goto rollback;
}
- sandbox_set_debugging_fd(get_err_logging_fd());
+ tor_log_update_sigsafe_err_fds();
commit:
r = 0;
diff --git a/src/or/main.c b/src/or/main.c
index ea86df073..a8f1c2306 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -2685,7 +2685,7 @@ tor_main(int argc, char *argv[])
}
#endif
- configure_backtrace_handler(NULL, get_version());
+ configure_backtrace_handler(get_version());
update_approx_time(time(NULL));
tor_threads_init();