From: "Pali Rohár" <pali@kernel.org>
To: "Marek Behún" <marek.behun@nic.cz>, "Stefan Roese" <sr@denx.de>,
"Marcel Ziswiler" <marcel@ziswiler.com>
Cc: u-boot@lists.denx.de
Subject: [PATCH] tools: kwboot: Allow to use -b without image path as the last getopt() option
Date: Mon, 7 Feb 2022 10:12:24 +0100 [thread overview]
Message-ID: <20220207091224.10390-1-pali@kernel.org> (raw)
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: c513fe47dca2 ("tools: kwboot: Allow to use option -b without image path")
Reported-by: Marcel Ziswiler <marcel@ziswiler.com>
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marcel Ziswiler <marcel@ziswiler.com>
Tested-by: Marcel Ziswiler <marcel@ziswiler.com>
---
tools/kwboot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/kwboot.c b/tools/kwboot.c
index 7737188f0d0a..68c0ef1f1b07 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -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;
--
2.20.1
next reply other threads:[~2022-02-07 9:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-07 9:12 Pali Rohár [this message]
2022-02-07 9:22 ` [PATCH] tools: kwboot: Allow to use -b without image path as the last getopt() option Stefan Roese
2022-02-10 8:19 ` Stefan Roese
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220207091224.10390-1-pali@kernel.org \
--to=pali@kernel.org \
--cc=marcel@ziswiler.com \
--cc=marek.behun@nic.cz \
--cc=sr@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.