mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
command: validate reporting of previous argument
When reporting parsing error, report 'previous' argument only when there is one.
This commit is contained in:
parent
4791d0f035
commit
e6a3c09017
@ -999,8 +999,8 @@ static void __add_optional_opt_line(struct cmd_context *cmdtool, struct command
|
||||
else if (takes_arg)
|
||||
_update_prev_opt_arg(cmdtool, cmd, argv[i], OPTIONAL);
|
||||
else {
|
||||
log_error("Parsing command defs: can't parse argc %d argv %s prev %s.",
|
||||
i, argv[i], argv[i-1]);
|
||||
log_error("Parsing command defs: can't parse argc %d argv %s%s%s.",
|
||||
i, argv[i], (i > 0) ? " prev " : "", (i > 0) ? argv[i - 1] : "");
|
||||
cmd->cmd_flags |= CMD_FLAG_PARSE_ERROR;
|
||||
return;
|
||||
}
|
||||
@ -1025,8 +1025,8 @@ static void _add_ignore_opt_line(struct cmd_context *cmdtool, struct command *cm
|
||||
else if (takes_arg)
|
||||
_update_prev_opt_arg(cmdtool, cmd, argv[i], IGNORE);
|
||||
else {
|
||||
log_error("Parsing command defs: can't parse argc %d argv %s prev %s.",
|
||||
i, argv[i], argv[i-1]);
|
||||
log_error("Parsing command defs: can't parse argc %d argv %s%s%s.",
|
||||
i, argv[i], (i > 0) ? " prev " : "", (i > 0) ? argv[i - 1] : "");
|
||||
cmd->cmd_flags |= CMD_FLAG_PARSE_ERROR;
|
||||
return;
|
||||
}
|
||||
@ -1060,8 +1060,8 @@ static void _add_required_opt_line(struct cmd_context *cmdtool, struct command *
|
||||
else if (takes_arg)
|
||||
_update_prev_opt_arg(cmdtool, cmd, argv[i], REQUIRED);
|
||||
else {
|
||||
log_error("Parsing command defs: can't parse argc %d argv %s prev %s.",
|
||||
i, argv[i], argv[i-1]);
|
||||
log_error("Parsing command defs: can't parse argc %d argv %s%s%s.",
|
||||
i, argv[i], (i > 0) ? " prev " : "", (i > 0) ? argv[i - 1] : "");
|
||||
cmd->cmd_flags |= CMD_FLAG_PARSE_ERROR;
|
||||
return;
|
||||
}
|
||||
@ -1150,8 +1150,8 @@ static void _add_required_line(struct cmd_context *cmdtool, struct command *cmd,
|
||||
/* set property for previous required_pos_arg */
|
||||
_update_prev_pos_arg(cmd, argv[i], REQUIRED);
|
||||
} else {
|
||||
log_error("Parsing command defs: can't parse argc %d argv %s prev %s.",
|
||||
i, argv[i], argv[i-1]);
|
||||
log_error("Parsing command defs: can't parse argc %d argv %s%s%s.",
|
||||
i, argv[i], (i > 0) ? " prev " : "", (i > 0) ? argv[i - 1] : "");
|
||||
cmd->cmd_flags |= CMD_FLAG_PARSE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user