[U-Boot] [PATCH 4/5] _do_setenv(): Delete 0-length environment variables
Peter Tyser
ptyser at xes-inc.com
Fri Oct 23 02:59:22 CEST 2009
Previously _do_setenv() would only delete an environment variable if it
was passed a NULL string pointer as a value. It should also delete an
environment variable when it encounters a valid string pointer of
0-length.
Signed-off-by: Peter Tyser <ptyser at xes-inc.com>
---
common/cmd_nvedit.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 9f8d531..725e573 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -400,7 +400,7 @@ int _do_setenv (int flag, int argc, char *argv[])
int setenv (char *varname, char *varvalue)
{
char *argv[4] = { "setenv", varname, varvalue, NULL };
- if (varvalue == NULL)
+ if ((varvalue == NULL) || (varvalue[0] == '\0'))
return _do_setenv (0, 2, argv);
else
return _do_setenv (0, 3, argv);
--
1.6.2.1
More information about the U-Boot
mailing list