summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-11-23 12:02:59 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-11-23 12:04:33 +0100
commit1c2c4246a9914bfdf234c6c636abcd27d9d3975c (patch)
treef99d52ccdae6a909a0923782bab8173631497061
parent30caa3917de8ecfd45f6b12aa4ffe00966f2e250 (diff)
downloadbarebox-1c2c4246a9914bfdf234c6c636abcd27d9d3975c.tar.gz
globalvar: When a globalvar is created with a NULL value, use empty string
As a convenience for users of globalvar_add_simple_string() create an empty value for the variable when passed a NULL pointer as value. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/globalvar.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/common/globalvar.c b/common/globalvar.c
index ee756e5..1db6bd9 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -459,6 +459,9 @@ int globalvar_add_simple_string(const char *name, char **value)
globalvar_nv_sync(name);
+ if (!*value)
+ *value = xstrdup("");
+
return 0;
}