initctl: Fix 'cond dump/set/clear' commands, only show worked

This patch fixes an invalid use of strpbrk() causing all cond
sub-commands, except initctl cond show, to fail.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2017-10-16 11:23:57 +02:00
parent 83445f1ebe
commit fd090a6785
+6 -7
View File
@@ -337,14 +337,13 @@ static int do_cond(char *cmd)
{ NULL, NULL }
};
arg = strpbrk(cmd, " ");
if (arg) {
*arg = 0;
arg = strpbrk(cmd, " \0");
if (arg)
*arg++ = 0;
for (c = 0; command[c].cmd; c++) {
if (!strcmp(command[c].cmd, cmd))
return command[c].cb(arg);
}
for (c = 0; command[c].cmd; c++) {
if (!strcmp(command[c].cmd, cmd))
return command[c].cb(arg);
}
return do_cond_show(NULL);