Test non-NULL name immediately, not in env_match().
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
static const char *env_match(const char *p, const char *s1)
{
- if (s1 == NULL || *s1 == '\0')
- return NULL;
-
while (*s1 == *p++)
if (*s1++ == '=')
return p;
{
const char *env, *p, *end;
+ if (name == NULL || *name == '\0')
+ return -1;
+
if (gd->env_valid == ENV_INVALID)
env = (const char *)default_environment;
else