提交 9e6d71d2 编写于 作者: P Pali Rohár 提交者: Stefan Roese

tools: kwboot: Allow to use -b without image path as the last getopt() option

Currently it is possible to call "kwboot -b -t /dev/ttyUSB0" but not to
call "kwboot -b /dev/ttyUSB0".

Fix it by not trying to process the last argv[], which is non-getopt()
option (tty path) as the image path for -b.

Fixes: c513fe47 ("tools: kwboot: Allow to use option -b without image path")
Reported-by: NMarcel Ziswiler <marcel@ziswiler.com>
Signed-off-by: NPali Rohár <pali@kernel.org>
Reviewed-by: NMarcel Ziswiler <marcel@ziswiler.com>
Tested-by: NMarcel Ziswiler <marcel@ziswiler.com>
上级 c153576d
......@@ -1770,7 +1770,7 @@ main(int argc, char **argv)
bootmsg = kwboot_msg_boot;
if (prev_optind == optind)
goto usage;
if (argv[optind] && argv[optind][0] != '-')
if (optind < argc - 1 && argv[optind] && argv[optind][0] != '-')
imgpath = argv[optind++];
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册