summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorAhmad Fatoum <ahmad@a3f.at>2020-11-26 19:31:53 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-11-27 10:02:36 +0100
commit870f45338872b5ac02b2f87b6409036a6292ecf3 (patch)
tree277a50b00792d1b7c39b0b9820242c992c2b76fc /commands
parent205864b2ea133d752d45368582c5d6d3e4cdcb75 (diff)
downloadbarebox-870f45338872b5ac02b2f87b6409036a6292ecf3.tar.gz
barebox-870f45338872b5ac02b2f87b6409036a6292ecf3.tar.xz
commands: nv: pass empty string for nv
Setting a variable via the nv command results in the call chain nvar_add() -> nv_save() -> __nv_save(). __nv_save isn't supposed to be called with val=NULL argument however: dprintf(fd, "%s", val); Avoid this from happening by translating NULL into the empty string. This aligns nv with the behavior of hush and setenv (but not global, this will need to be looked at separately). Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/nv.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/commands/nv.c b/commands/nv.c
index fa865811dc..a1cff08ee4 100644
--- a/commands/nv.c
+++ b/commands/nv.c
@@ -59,6 +59,8 @@ static int do_nv(int argc, char *argv[])
if (value) {
*value = 0;
value++;
+ } else {
+ value = "";
}
if (do_remove) {