diff options
author | Peter Tyser <ptyser@xes-inc.com> | 2009-10-25 15:12:55 -0500 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2009-10-27 20:58:25 +0100 |
commit | b0fa8e50632a628766db23f5c884ec63f1469552 (patch) | |
tree | dd7ceb98ee9fb5fa678153c6187df2e42aefd25f /common/cmd_nvedit.c | |
parent | ecc5500ee487170d8af6ff893fd1e0082380a01a (diff) | |
download | u-boot-midas-b0fa8e50632a628766db23f5c884ec63f1469552.tar.gz u-boot-midas-b0fa8e50632a628766db23f5c884ec63f1469552.tar.bz2 u-boot-midas-b0fa8e50632a628766db23f5c884ec63f1469552.zip |
setenv(): Delete 0-length environment variables
Previously 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.
This change/fix is generally useful and is necessary for the upcoming
"editenv" command.
Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
Diffstat (limited to 'common/cmd_nvedit.c')
-rw-r--r-- | 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 9f8d531959..725e573ddf 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); |