From: Ahmad Fatoum <ahmad@a3f.at>
To: barebox@lists.infradead.org
Subject: [PATCH 2/4] commands: nv: fix set/remove of multiple variables in one go
Date: Thu, 26 Nov 2020 19:31:52 +0100 [thread overview]
Message-ID: <20201126183154.348024-2-ahmad@a3f.at> (raw)
In-Reply-To: <20201126183154.348024-1-ahmad@a3f.at>
Multiple nonopt arguments seems to have never worked, because the value
was always extracted out of the first non-opt argument. After the first
iteration, it'll have it's '=' stripped and thus value == NULL for all i
> 0. Fix this.
Before:
$ nv a=1 b=2 c=3
$ echo "[$nv.a $nv.b $nv.c]"
[1 ]
After:
$ nv a=1 b=2 c=3
$ echo "[$nv.a $nv.b $nv.c]"
[1 2 3]
Fixes: 0c2fccceb625 ("nv: Allow to set/remove multiple variables with one command")
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
commands/nv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/commands/nv.c b/commands/nv.c
index 8d4192402ca5..fa865811dce2 100644
--- a/commands/nv.c
+++ b/commands/nv.c
@@ -55,7 +55,7 @@ static int do_nv(int argc, char *argv[])
for (i = 0; i < argc; i++) {
int ret;
- value = strchr(argv[0], '=');
+ value = strchr(argv[i], '=');
if (value) {
*value = 0;
value++;
--
2.28.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2020-11-26 18:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-26 18:31 [PATCH 1/4] hush: remove non-functional code Ahmad Fatoum
2020-11-26 18:31 ` Ahmad Fatoum [this message]
2020-11-26 18:31 ` [PATCH 3/4] commands: nv: pass empty string for nv Ahmad Fatoum
2020-11-26 18:31 ` [PATCH 4/4] commands: implement and use parse_assignment helper Ahmad Fatoum
2020-11-27 9:02 ` [PATCH 1/4] hush: remove non-functional code Sascha Hauer
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=20201126183154.348024-2-ahmad@a3f.at \
--to=ahmad@a3f.at \
--cc=barebox@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox