Commit 930722b2 authored by Niels Möller's avatar Niels Möller
Browse files

(server_config_parse_example): Don't use options where the example is

NULL.

Rev: src/server_config.c:1.4
parent fba1ce71
...@@ -348,38 +348,39 @@ server_config_parse_example(const struct config_parser *parser, ...@@ -348,38 +348,39 @@ server_config_parse_example(const struct config_parser *parser,
const struct config_option *option; const struct config_option *option;
for (option = parser->options; option->type != CONFIG_TYPE_NONE; option++) for (option = parser->options; option->type != CONFIG_TYPE_NONE; option++)
{ if (option->example)
uint32_t value = 0; {
const uint8_t *data = NULL; uint32_t value = 0;
const uint8_t *data = NULL;
unsigned length = strlen(option->example);
unsigned length = strlen(option->example);
switch (option->type)
{ switch (option->type)
default: {
fatal("Internal error.\n"); default:
fatal("Internal error.\n");
case CONFIG_TYPE_BOOL:
err = parse_value_bool(&value, length, option->example); case CONFIG_TYPE_BOOL:
break; err = parse_value_bool(&value, length, option->example);
break;
case CONFIG_TYPE_UNSIGNED:
err = parse_value_unsigned(&value, length, option->example); case CONFIG_TYPE_UNSIGNED:
break; err = parse_value_unsigned(&value, length, option->example);
break;
case CONFIG_TYPE_STRING:
value = length; case CONFIG_TYPE_STRING:
data = option->example; value = length;
break; data = option->example;
} break;
}
if (err) if (err)
fatal("Bad example value for configuration option `%z'\n", fatal("Bad example value for configuration option `%z'\n",
option->name); option->name);
else else
err = group->parser->handler(option->key, value, data, &group->state); err = group->parser->handler(option->key, value, data, &group->state);
} }
} }
return parser_finalize(&state, err); return parser_finalize(&state, err);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment