diff options
author | Ahmad Fatoum <ahmad@a3f.at> | 2020-11-26 19:31:52 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-11-27 10:02:36 +0100 |
commit | 205864b2ea133d752d45368582c5d6d3e4cdcb75 (patch) | |
tree | 1f00bfeb5ba4274dab67a5d08454b7511cdf9f60 | |
parent | d96c54acb8c0fd05446ce9bffd931510d2b229e1 (diff) | |
download | barebox-205864b2ea133d752d45368582c5d6d3e4cdcb75.tar.gz barebox-205864b2ea133d752d45368582c5d6d3e4cdcb75.tar.xz |
commands: nv: fix set/remove of multiple variables in one go
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>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | commands/nv.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/commands/nv.c b/commands/nv.c index 8d4192402c..fa865811dc 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++; |