diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2017-05-08 20:08:02 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-05-24 09:15:20 +0200 |
commit | eead1070abee567eb7db708f42b319e26e92de74 (patch) | |
tree | 35e5df08c819e204b49a5b7f4dffbff59d2f8a68 | |
parent | e4b9bcd663546852621f44d135da6096f90bbb1e (diff) | |
download | barebox-eead1070abee567eb7db708f42b319e26e92de74.tar.gz barebox-eead1070abee567eb7db708f42b319e26e92de74.tar.xz |
globalvar: Fix value of new globalvar when nvvar exists
When a new globalvar with a value is created and the corresponding
nvvar exists, then the globalvar gets the value of the nvvar, not
from the newly assigned value as expected.
nv quux=foo; global quux=bar; echo ${global.quux}
Should give "bar", not "foo". Fix this.
Reported-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | common/globalvar.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/common/globalvar.c b/common/globalvar.c index 1ecf5134af..549a07d155 100644 --- a/common/globalvar.c +++ b/common/globalvar.c @@ -422,11 +422,11 @@ int globalvar_add_simple(const char *name, const char *value) return PTR_ERR(param); } + globalvar_nv_sync(name); + if (value) dev_set_param(&global_device, name, value); - globalvar_nv_sync(name); - return 0; } |