]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
env: Fix env_get() when returning empty string using env_get_f()
authorMarek Behún <marek.behun@nic.cz>
Wed, 3 Nov 2021 23:23:22 +0000 (00:23 +0100)
committerSimon Glass <sjg@chromium.org>
Sat, 13 Nov 2021 15:16:39 +0000 (08:16 -0700)
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>
env/common.c

index 2aa23545ba3d39c1226449f88052f6a5aeb62d1e..757c5f9ecdb6465074d64af55336b0810d8814f9 100644 (file)
@@ -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;