diff options
author | Marek BehĂșn <marek.behun@nic.cz> | 2021-11-04 00:23:22 +0100 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2021-11-13 08:16:39 -0700 |
commit | e8459c12fd2e9b4068041a931ce6da62ac648000 (patch) | |
tree | 8c9dd382bdcc4d64b507b97f354f5e99f493601a | |
parent | c9db4c5440d760eedf80448d42559125ee1d0626 (diff) | |
download | u-boot-e8459c12fd2e9b4068041a931ce6da62ac648000.zip u-boot-e8459c12fd2e9b4068041a931ce6da62ac648000.tar.gz u-boot-e8459c12fd2e9b4068041a931ce6da62ac648000.tar.bz2 |
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>
-rw-r--r-- | env/common.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/env/common.c b/env/common.c index 2aa2354..757c5f9 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; |