summaryrefslogtreecommitdiff
path: root/env
diff options
context:
space:
mode:
authorMarek BehĂșn <marek.behun@nic.cz>2021-11-04 00:23:22 +0100
committerSimon Glass <sjg@chromium.org>2021-11-13 08:16:39 -0700
commite8459c12fd2e9b4068041a931ce6da62ac648000 (patch)
tree8c9dd382bdcc4d64b507b97f354f5e99f493601a /env
parentc9db4c5440d760eedf80448d42559125ee1d0626 (diff)
downloadu-boot-e8459c12fd2e9b4068041a931ce6da62ac648000.tar.gz
u-boot-e8459c12fd2e9b4068041a931ce6da62ac648000.tar.bz2
u-boot-e8459c12fd2e9b4068041a931ce6da62ac648000.zip
env: Fix env_get() when returning empty string using env_get_f()
The env_get_f() function returns -1 on failure. Returning 0 means that the variable exists, and is empty string. Signed-off-by: Marek BehĂșn <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'env')
-rw-r--r--env/common.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/env/common.c b/env/common.c
index 2aa23545ba..757c5f9ecd 100644
--- a/env/common.c
+++ b/env/common.c
@@ -125,7 +125,7 @@ char *env_get(const char *name)
}
/* restricted capabilities before import */
- if (env_get_f(name, (char *)(gd->env_buf), sizeof(gd->env_buf)) > 0)
+ if (env_get_f(name, (char *)(gd->env_buf), sizeof(gd->env_buf)) >= 0)
return (char *)(gd->env_buf);
return NULL;