[PATCH 06/11] globalvar: Do not modify already existing variables

Sascha Hauer s.hauer at pengutronix.de
Fri Sep 27 02:47:37 EDT 2013


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 at pengutronix.de>
---
 common/globalvar.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/common/globalvar.c b/common/globalvar.c
index edb66dd..abd1270 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);
 }
 
-- 
1.8.4.rc3




More information about the barebox mailing list