From: Peter Korsgaard <jacmet@sunsite.dk>
To: barebox@lists.infradead.org
Subject: [PATCH] setenv: be robust against setenv(<var>, NULL)
Date: Sat, 14 May 2011 22:33:51 +0200 [thread overview]
Message-ID: <1305405231-22863-1-git-send-email-jacmet@sunsite.dk> (raw)
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
reply other threads:[~2011-05-14 20:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1305405231-22863-1-git-send-email-jacmet@sunsite.dk \
--to=jacmet@sunsite.dk \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox