diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-09-25 17:15:23 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-09-27 11:14:45 +0200 |
commit | 49730778729ec9b237a9b87d77ea688de09966b5 (patch) | |
tree | 312f4084c001a24daa4847c3297ab6278d0c5ca3 /common | |
parent | 61d6a8485db04bdf6eeed187e9790c9a7f38e848 (diff) | |
download | barebox-49730778729ec9b237a9b87d77ea688de09966b5.tar.gz barebox-49730778729ec9b237a9b87d77ea688de09966b5.tar.xz |
globalvar: Do not modify already existing variables
When globalvar_add_simple was called on previously existing variables
then the value was overwritten, even when value was passed as NULL.
Do not overwrite the value in this case which allows us to do a 'global'
on the same variable multiple times without loosing the values.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r-- | common/globalvar.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/common/globalvar.c b/common/globalvar.c index edb66ddca6..abd1270f74 100644 --- a/common/globalvar.c +++ b/common/globalvar.c @@ -72,6 +72,9 @@ int globalvar_add_simple(const char *name, const char *value) if (ret && ret != -EEXIST) return ret; + if (!value) + return 0; + return dev_set_param(&global_device, name, value); } |