config: fix boolean parsing

The rest of the line contains the newline, so cannot match simply 'true'
or 'false'.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This commit is contained in:
Pekka Paalanen 2011-11-15 11:45:41 +02:00 committed by Kristian Høgsberg
parent fc32c394e7
commit 09d65d0e64
1 changed files with 2 additions and 2 deletions

View File

@ -54,9 +54,9 @@ handle_key(const struct config_key *key, const char *value)
return 0;
case CONFIG_KEY_BOOL:
if (strcmp(value, "false") == 0)
if (strcmp(value, "false\n") == 0)
*(int *)key->data = 0;
else if (strcmp(value, "true") == 0)
else if (strcmp(value, "true\n") == 0)
*(int *)key->data = 1;
else {
fprintf(stderr, "invalid bool: %s\n", value);