diff options
Diffstat (limited to 'src/or/config.c')
-rw-r--r-- | src/or/config.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/or/config.c b/src/or/config.c index d11835463..8a19ed6d4 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -748,7 +748,7 @@ set_options(or_options_t *new_val, char **msg) } /* Issues a CONF_CHANGED event to notify controller of the change. If Tor is * just starting up then the old_options will be undefined. */ - if (old_options) { + if (old_options && old_options != global_options) { elements = smartlist_new(); for (i=0; options_format.vars[i].name; ++i) { const config_var_t *var = &options_format.vars[i]; @@ -774,7 +774,9 @@ set_options(or_options_t *new_val, char **msg) control_event_conf_changed(elements); smartlist_free(elements); } - config_free(&options_format, old_options); + + if (old_options != global_options) + config_free(&options_format, old_options); return 0; } @@ -783,6 +785,7 @@ extern const char tor_git_revision[]; /* from tor_main.c */ /** The version of this Tor process, as parsed. */ static char *the_tor_version = NULL; +static char *the_short_tor_version = NULL; /** Return the current Tor version. */ const char * @@ -790,14 +793,31 @@ get_version(void) { if (the_tor_version == NULL) { if (strlen(tor_git_revision)) { - tor_asprintf(&the_tor_version, "%s (git-%s)", VERSION, tor_git_revision); + tor_asprintf(&the_tor_version, "%s (git-%s)", get_short_version(), + tor_git_revision); } else { - the_tor_version = tor_strdup(VERSION); + the_tor_version = tor_strdup(get_short_version()); } } return the_tor_version; } +/** Return the current Tor version, without any git tag. */ +const char * +get_short_version(void) +{ + + if (the_short_tor_version == NULL) { +#ifdef TOR_BUILD_TAG + tor_asprintf(&the_short_tor_version, "%s (%s)", VERSION, TOR_BUILD_TAG); +#else + the_short_tor_version = tor_strdup(VERSION); +#endif + } + return the_short_tor_version; +} + + /** Release additional memory allocated in options */ static void @@ -1118,7 +1138,8 @@ options_act_reversible(const or_options_t *old_options, char **msg) * networking is disabled, this will close all but the control listeners, * but disable those. */ if (!we_are_hibernating()) { - if (retry_all_listeners(replaced_listeners, new_listeners) < 0) { + if (retry_all_listeners(replaced_listeners, new_listeners, + options->DisableNetwork) < 0) { *msg = tor_strdup("Failed to bind one of the listener ports."); goto rollback; } |