modprobe: fix parsing of short lines.

The intent here seems to have been to ignore lines with too few
arguments to be valid, but since strtok() returns NULL at the end of the
string, if you only have "verb noun", you'd be falsely rejected.

Since we've kept a count anyway, just check the count.
This commit is contained in:
Elliott Hughes 2021-06-03 15:15:57 -07:00 committed by Rob Landley
parent d02da4ec60
commit 0842ada4d6

View File

@ -238,7 +238,8 @@ static int config_action(struct dirtree *node)
break;
}
}
if (!tk) continue;
// Every command requires at least one argument.
if (tcount < 2) continue;
// process the tokens[0] contains first word of config line.
if (!strcmp(tokens[0], "alias")) {
struct arg_list *temp;