mirror of
https://github.com/u-boot/u-boot.git
synced 2024-11-25 21:24:21 +08:00
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>
This commit is contained in:
parent
ecc5500ee4
commit
b0fa8e5063
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user