summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-01-14 14:15:29 -0500
committerNick Mathewson <nickm@torproject.org>2015-01-14 14:15:29 -0500
commit3668a4126e0c2502a77c2ba5d7885add489a964a (patch)
treef759dadb07680017dac7d9a4e12ba9fe3b0d52a8
parent1686f81ac25328382a46ffe569db1d371f6b6be2 (diff)
parentb06b783fa0644f5166211a6c328e0f5d8b280962 (diff)
downloadtor-3668a4126e0c2502a77c2ba5d7885add489a964a.tar.gz
tor-3668a4126e0c2502a77c2ba5d7885add489a964a.zip
Merge remote-tracking branch 'public/bug13397'
-rw-r--r--changes/bug133974
-rw-r--r--src/or/config.c20
2 files changed, 13 insertions, 11 deletions
diff --git a/changes/bug13397 b/changes/bug13397
new file mode 100644
index 0000000000..502092801f
--- /dev/null
+++ b/changes/bug13397
@@ -0,0 +1,4 @@
+ o Minor bugfixes:
+ - Avoid crashing when trying to reload a torrc specified as a relative
+ path with RunAsDaemon turned on. Fixes bug 13397; bugfix on
+ 0.2.3.11-alpha.
diff --git a/src/or/config.c b/src/or/config.c
index 5db065f000..982cb2e9e5 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -2650,11 +2650,6 @@ options_validate(or_options_t *old_options, or_options_t *options,
REJECT("Failed to resolve/guess local address. See logs for details.");
}
-#ifndef _WIN32
- if (options->RunAsDaemon && torrc_fname && path_is_relative(torrc_fname))
- REJECT("Can't use a relative path to torrc when RunAsDaemon is set.");
-#endif
-
if (server_mode(options) && options->RendConfigLines)
log_warn(LD_CONFIG,
"Tor is currently configured as a relay and a hidden service. "
@@ -4221,14 +4216,17 @@ load_torrc_from_disk(config_line_t *cmd_arg, int defaults_file)
int ignore_missing_torrc = 0;
char **fname_var = defaults_file ? &torrc_defaults_fname : &torrc_fname;
- fname = find_torrc_filename(cmd_arg, defaults_file,
- &using_default_torrc, &ignore_missing_torrc);
- tor_assert(fname);
+ if (*fname_var == NULL) {
+ fname = find_torrc_filename(cmd_arg, defaults_file,
+ &using_default_torrc, &ignore_missing_torrc);
+ tor_assert(fname);
+ tor_free(*fname_var);
+ *fname_var = fname;
+ } else {
+ fname = *fname_var;
+ }
log_debug(LD_CONFIG, "Opening config file \"%s\"", fname);
- tor_free(*fname_var);
- *fname_var = fname;
-
/* Open config file */
file_status_t st = file_status(fname);
if (!(st == FN_FILE || st == FN_EMPTY) ||