Commit a21d8f1c authored by Andrei Vagin's avatar Andrei Vagin Committed by Andrei Vagin

config: skip spaces at a beginning of lines

Otherwise lines started with spaces are ignored.

Cc: Veronika Kabatova <vkabatov@redhat.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent c1a4545a
......@@ -57,7 +57,12 @@ static char ** parse_config(char *filepath)
}
configuration = tmp_conf;
}
while (sscanf(line + offset, "%m[^ \t\n]s", &configuration[i]) == 1) {
while (1) {
while ((isspace(*(line + offset)) && (*(line + offset) != '\n'))) offset++;
if (sscanf(line + offset, "%m[^ \t\n]s", &configuration[i]) != 1)
break;
if (configuration[i][0] == '#') {
if (sscanf(line, "%*[^\n]") != 0) {
pr_err("Error while reading configuration file %s\n", filepath);
......@@ -113,7 +118,6 @@ static char ** parse_config(char *filepath)
configuration[i] = tmp_string;
}
i++;
while ((isspace(*(line + offset)) && (*(line + offset) != '\n'))) offset++;
}
line = NULL;
}
......
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