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>
This commit is contained in:
Marek Behún 2021-11-04 00:23:22 +01:00 committed by Simon Glass
parent c9db4c5440
commit e8459c12fd

2
env/common.c vendored
View 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;