subr_hints: Skip static_env and static_hints if they don't contain hints

This is possible because, well, they're static. Both the dynamic environment
and the MD-environment (generally loader(8) environment) can potentially
have room for new variables to be set, and thus do not receive this
treatment.
This commit is contained in:
Kyle Evans 2018-07-10 00:36:37 +00:00
parent dc4446df5f
commit 0f46005e4b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=336154

View File

@ -49,7 +49,9 @@ __FBSDID("$FreeBSD$");
* static_hints to the dynamic environment.
*/
static bool hintenv_merged;
/* Static environment and static hints cannot change, so we'll skip known bad */
static bool stenv_skip;
static bool sthints_skip;
/*
* Access functions for device resources.
*/
@ -179,17 +181,21 @@ res_find(char **hintp_cookie, int *line, int *startln,
}
fbacklvl++;
if (fbacklvl <= FBACK_STENV &&
if (!stenv_skip && fbacklvl <= FBACK_STENV &&
_res_checkenv(kern_envp)) {
hintp = kern_envp;
goto found;
}
} else
stenv_skip = true;
fbacklvl++;
/* We'll fallback to static_hints if needed/can */
if (fbacklvl <= FBACK_STATIC &&
if (!sthints_skip && fbacklvl <= FBACK_STATIC &&
_res_checkenv(static_hints))
hintp = static_hints;
else
sthints_skip = true;
found:
fbacklvl++;
}