mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] setenv: be robust against setenv(<var>, NULL)
@ 2011-05-14 20:33 Peter Korsgaard
  0 siblings, 0 replies; only message in thread
From: Peter Korsgaard @ 2011-05-14 20:33 UTC (permalink / raw)
  To: barebox

Handle value == NULL similiar to how value == '' is currently handled.
hush's builtin_getopt() seems to trigger this for OPTARG.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
---
 common/env.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/env.c b/common/env.c
index b72b5d1..47cef05 100644
--- a/common/env.c
+++ b/common/env.c
@@ -205,7 +205,7 @@ int setenv(const char *_name, const char *value)
 	struct variable_d *var;
 	int ret = 0;
 
-	if (!*value)
+	if (value && !*value)
 		value = NULL;
 
 
-- 
1.7.4.4


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-05-14 20:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-14 20:33 [PATCH] setenv: be robust against setenv(<var>, NULL) Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox