diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/or/config.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/or/config.c b/src/or/config.c index de1c6e0b3f..be3b14fa0e 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -1108,6 +1108,22 @@ options_act_reversible(or_options_t *old_options, char **msg) /* No need to roll back, since you can't change the value. */ } + if (directory_caches_v2_dir_info(options)) { + size_t len = strlen(options->DataDirectory)+32; + char *fn = tor_malloc(len); + tor_snprintf(fn, len, "%s"PATH_SEPARATOR"cached-status", + options->DataDirectory); + if (check_private_dir(fn, running_tor ? CPD_CREATE : CPD_CHECK) < 0) { + char buf[1024]; + int tmp = tor_snprintf(buf, sizeof(buf), + "Couldn't access/create private data directory \"%s\"", fn); + *msg = tor_strdup(tmp >= 0 ? buf : "internal error"); + tor_free(fn); + goto done; + } + tor_free(fn); + } + /* Bail out at this point if we're not going to be a client or server: * we don't run Tor itself. */ if (!running_tor) @@ -1203,8 +1219,6 @@ static int options_act(or_options_t *old_options) { config_line_t *cl; - char *fn; - size_t len; or_options_t *options = get_options(); int running_tor = options->command == CMD_RUN_TOR; char *msg; @@ -1240,20 +1254,6 @@ options_act(or_options_t *old_options) return -1; } - if (running_tor && directory_caches_v2_dir_info(options)) { - len = strlen(options->DataDirectory)+32; - fn = tor_malloc(len); - tor_snprintf(fn, len, "%s"PATH_SEPARATOR"cached-status", - options->DataDirectory); - if (check_private_dir(fn, CPD_CREATE) != 0) { - log_warn(LD_CONFIG, - "Couldn't access/create private data directory \"%s\"", fn); - tor_free(fn); - return -1; - } - tor_free(fn); - } - /* Load state */ if (! global_state && running_tor) { if (or_state_load()) |