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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux