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

config: initialize the last element of a config argv as NULL

Now we rely on scanf, that it will initializes a pointer to NULL, when
it fails to parse a string, but I can't find in a man page, that it has
to do this.
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent a21d8f1c
......@@ -60,8 +60,10 @@ static char ** parse_config(char *filepath)
while (1) {
while ((isspace(*(line + offset)) && (*(line + offset) != '\n'))) offset++;
if (sscanf(line + offset, "%m[^ \t\n]s", &configuration[i]) != 1)
if (sscanf(line + offset, "%m[^ \t\n]s", &configuration[i]) != 1) {
configuration[i] = NULL;
break;
}
if (configuration[i][0] == '#') {
if (sscanf(line, "%*[^\n]") != 0) {
......
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