diff --git a/src/or/config.c b/src/or/config.c index fd8d6a2005..02756d0754 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -681,10 +681,10 @@ config_assign(or_options_t *options, struct config_line_t *list, int reset) * keys, -2 on bad values, -3 on bad transition. */ int -config_trial_assign(or_options_t **options, struct config_line_t *list, int reset) +config_trial_assign(or_options_t *options, struct config_line_t *list, int reset) { int r; - or_options_t *trial_options = options_dup(*options); + or_options_t *trial_options = options_dup(options); if ((r=config_assign(trial_options, list, reset)) < 0) { options_free(trial_options); @@ -696,12 +696,12 @@ config_trial_assign(or_options_t **options, struct config_line_t *list, int rese return -2; } - if (options_transition_allowed(*options, trial_options) < 0) { + if (options_transition_allowed(options, trial_options) < 0) { options_free(trial_options); return -3; } - *options = trial_options; + set_options(trial_options); /* we liked it. put it in place. */ return 0; } diff --git a/src/or/control.c b/src/or/control.c index 0a428e9612..6a714c1ed3 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -202,7 +202,6 @@ handle_control_setconf(connection_t *conn, uint16_t len, char *body) { int r; struct config_line_t *lines=NULL; - or_options_t *options = get_options(); if (config_get_lines(body, &lines) < 0) { log_fn(LOG_WARN,"Controller gave us config lines we can't parse."); @@ -210,7 +209,7 @@ handle_control_setconf(connection_t *conn, uint16_t len, char *body) return 0; } - if ((r=config_trial_assign(&options, lines, 1)) < 0) { + if ((r=config_trial_assign(get_options(), lines, 1)) < 0) { log_fn(LOG_WARN,"Controller gave us config lines that didn't validate."); if (r==-1) { send_control_error(conn, ERR_UNRECOGNIZED_CONFIG_KEY, @@ -223,7 +222,6 @@ handle_control_setconf(connection_t *conn, uint16_t len, char *body) } config_free_lines(lines); - set_options(options); /* put the new one into place */ if (options_act() < 0) { /* acting on them failed. die. */ log_fn(LOG_ERR,"Acting on config options left us in a broken state. Dying."); exit(1); diff --git a/src/or/or.h b/src/or/or.h index b363a46acc..0f0d7e83a0 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -1097,7 +1097,7 @@ int options_act(void); int config_get_lines(char *string, struct config_line_t **result); void config_free_lines(struct config_line_t *front); -int config_trial_assign(or_options_t **options, struct config_line_t *list, int reset); +int config_trial_assign(or_options_t *options, struct config_line_t *list, int reset); int resolve_my_address(const char *address, uint32_t *addr); void options_init(or_options_t *options); int init_from_config(int argc, char **argv);