From: Marek BehĂșn Date: Wed, 3 Nov 2021 23:23:22 +0000 (+0100) Subject: env: Fix env_get() when returning empty string using env_get_f() X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=e8459c12fd2e9b4068041a931ce6da62ac648000;p=u-boot.git 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 Reviewed-by: Simon Glass --- 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;