summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-11-12 18:23:47 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-11-23 16:48:12 +0100
commit656a6f0e97770bb8a2a1a76734a87abbbeff7d56 (patch)
tree2565bf7019c5c9f7288035acaa62d5b9b3d51a6d /commands
parent51178d4979c9caeef95d616dcd3d47bdcd81a58e (diff)
downloadbarebox-656a6f0e97770bb8a2a1a76734a87abbbeff7d56.tar.gz
barebox-656a6f0e97770bb8a2a1a76734a87abbbeff7d56.tar.xz
setenv: align with POSIX in handling of setenv(var, "")
setenv(var, "") to delete var is a barebox idiosyncrasy. Previous commit added unsetenv and changed all users of setenv(var, ""), so lets set the behavior of setenv to what's expected: set var to the empty string. Previously, "" was turned into NULL, which meant it wasn't possible to set variables to the empty string from the shell. This is now possible. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/setenv.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/commands/setenv.c b/commands/setenv.c
index 6992f604f5..9aeb8f010b 100644
--- a/commands/setenv.c
+++ b/commands/setenv.c
@@ -18,8 +18,7 @@ static int do_setenv(int argc, char *argv[])
equal = strrchr(argv[1], '=');
if (equal) {
equal[0] = '\0';
- if (equal[1])
- argv[2] = &equal[1];
+ argv[2] = &equal[1];
}
if (argv[2])