Change interface to config_trial_assign even more; have it use get_options() instead

svn:r2754
This commit is contained in:
Nick Mathewson 2004-11-09 17:15:17 +00:00
parent a2079c074f
commit b960574556
3 changed files with 6 additions and 6 deletions

View File

@ -674,17 +674,17 @@ config_assign(or_options_t *options, struct config_line_t *list, int reset)
return 0; return 0;
} }
/** Try assigning <b>list</b> to <b>options</b>. You do this by duping /** Try assigning <b>list</b> to the global options. You do this by duping
* options, assigning list to the new one, then validating it. If it's * options, assigning list to the new one, then validating it. If it's
* ok, then through out the old one and stick with the new one. Else, * ok, then through out the old one and stick with the new one. Else,
* revert to old and return failure. Return 0 on success, -1 on bad * revert to old and return failure. Return 0 on success, -1 on bad
* keys, -2 on bad values, -3 on bad transition. * keys, -2 on bad values, -3 on bad transition.
*/ */
int int
config_trial_assign(or_options_t *options, struct config_line_t *list, int reset) config_trial_assign(struct config_line_t *list, int reset)
{ {
int r; int r;
or_options_t *trial_options = options_dup(options); or_options_t *trial_options = options_dup(get_options());
if ((r=config_assign(trial_options, list, reset)) < 0) { if ((r=config_assign(trial_options, list, reset)) < 0) {
options_free(trial_options); options_free(trial_options);
@ -696,7 +696,7 @@ config_trial_assign(or_options_t *options, struct config_line_t *list, int reset
return -2; return -2;
} }
if (options_transition_allowed(options, trial_options) < 0) { if (options_transition_allowed(get_options(), trial_options) < 0) {
options_free(trial_options); options_free(trial_options);
return -3; return -3;
} }

View File

@ -209,7 +209,7 @@ handle_control_setconf(connection_t *conn, uint16_t len, char *body)
return 0; return 0;
} }
if ((r=config_trial_assign(get_options(), lines, 1)) < 0) { if ((r=config_trial_assign(lines, 1)) < 0) {
log_fn(LOG_WARN,"Controller gave us config lines that didn't validate."); log_fn(LOG_WARN,"Controller gave us config lines that didn't validate.");
if (r==-1) { if (r==-1) {
send_control_error(conn, ERR_UNRECOGNIZED_CONFIG_KEY, send_control_error(conn, ERR_UNRECOGNIZED_CONFIG_KEY,

View File

@ -1097,7 +1097,7 @@ int options_act(void);
int config_get_lines(char *string, struct config_line_t **result); int config_get_lines(char *string, struct config_line_t **result);
void config_free_lines(struct config_line_t *front); 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(struct config_line_t *list, int reset);
int resolve_my_address(const char *address, uint32_t *addr); int resolve_my_address(const char *address, uint32_t *addr);
void options_init(or_options_t *options); void options_init(or_options_t *options);
int init_from_config(int argc, char **argv); int init_from_config(int argc, char **argv);