summaryrefslogtreecommitdiff
path: root/src/or/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/config.c')
-rw-r--r--src/or/config.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/or/config.c b/src/or/config.c
index c7c61549ae..8035afbc79 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -126,7 +126,7 @@ static config_abbrev_t option_abbrevs_[] = {
*/
static config_var_t option_vars_[] = {
V(AccountingMax, MEMUNIT, "0 bytes"),
- V(AccountingRule, STRING, "max"),
+ VAR("AccountingRule", STRING, AccountingRule_option, "max"),
V(AccountingStart, STRING, NULL),
V(Address, STRING, NULL),
V(AllowDotExit, BOOL, "0"),
@@ -3109,9 +3109,15 @@ options_validate(or_options_t *old_options, or_options_t *options,
"risky: they will all turn off at the same time, which may "
"alert observers that they are being run by the same party.");
}
- if (options->AccountingRule &&
- strcmp(options->AccountingRule, "sum") != 0 &&
- strcmp(options->AccountingRule, "max") != 0)
+ }
+
+ options->AccountingRule = ACCT_MAX;
+ if (options->AccountingRule_option) {
+ if (!strcmp(options->AccountingRule_option, "sum"))
+ options->AccountingRule = ACCT_SUM;
+ else if (!strcmp(options->AccountingRule_option, "max"))
+ options->AccountingRule = ACCT_MAX;
+ else
REJECT("AccountingRule must be 'sum' or 'max'");
}