summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-11-12 18:23:46 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-11-23 16:48:05 +0100
commit51178d4979c9caeef95d616dcd3d47bdcd81a58e (patch)
tree2cfb79d6df18ff969ba6d7552cef899ef9f58b7a /net
parent0c2c24508d810a59709d598474b20eff4b81c4f9 (diff)
downloadbarebox-51178d4979c9caeef95d616dcd3d47bdcd81a58e.tar.gz
barebox-51178d4979c9caeef95d616dcd3d47bdcd81a58e.tar.xz
fs: introduce unsetenv() to prepare for changing setenv(var, "") behavior
Currently, we treat setenv(var, "") and setenv(var, NULL) the same and delete var, which is surprising and leads to subtle quirks: - setenv(var, "") is specified by POSIX to set var to an empty string, but barebox uses it to delete variables - nv.user= calls nv_set with NULL parameter, but nv user="" doesn't Make the API more POSIX-like by providing unsetenv with the expected semantics. Most user code can then use unsetenv without worrying about whether "" or NULL is the magic deletion value. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'net')
-rw-r--r--net/ifup.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ifup.c b/net/ifup.c
index a74037939b..1870f74017 100644
--- a/net/ifup.c
+++ b/net/ifup.c
@@ -86,7 +86,7 @@ static int source_env_network(struct eth_device *edev)
env_push_context();
for (i = 0; i < ARRAY_SIZE(vars); i++)
- setenv(vars[i], "");
+ unsetenv(vars[i]);
cmd = basprintf("source /env/network/%s", edev->devname);
ret = run_command(cmd);