From 4f033348f445cbd9929bf7297f07c1e160fdcce3 Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Sat, 27 Apr 2002 22:32:57 +0000 Subject: Finish fixing hints. Remember the use_kenv state for the next run. Otherwise we fall back to using the static hints the next time around. We still have the leftover fallback code there which meant that we skipped the use_hints checking on the second and subsequent calls. Also, be a bit more careful about walking off the end of the envp array. I've extracted this from a larger diff. I hope I didn't miss anything... --- sys/kern/subr_hints.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'sys/kern') diff --git a/sys/kern/subr_hints.c b/sys/kern/subr_hints.c index 27845644d19e..919106e4015a 100644 --- a/sys/kern/subr_hints.c +++ b/sys/kern/subr_hints.c @@ -37,6 +37,7 @@ */ static int checkmethod = 1; +static int use_kenv; static char *hintp; /* @@ -50,7 +51,7 @@ res_find(int *line, int *startln, const char **ret_name, int *ret_namelen, int *ret_unit, const char **ret_resname, int *ret_resnamelen, const char **ret_value) { - int n = 0, hit, use_kenv, i = 0; + int n = 0, hit, i = 0; char r_name[32]; int r_unit; char r_resname[32]; @@ -58,7 +59,6 @@ res_find(int *line, int *startln, const char *s, *cp; char *p; - use_kenv = 0; if (checkmethod) { switch (hintmode) { case 0: /* config supplied nothing */ @@ -148,16 +148,18 @@ res_find(int *line, int *startln, hit = 0; if (hit) break; - if (use_kenv) + if (use_kenv) { cp = kenvp[++i]; - else { + if (cp == NULL) + break; + } else { while (*cp != '\0') cp++; cp++; - } - if (*cp == '\0') { - cp = NULL; - break; + if (*cp == '\0') { + cp = NULL; + break; + } } } if (use_kenv) -- cgit v1.2.3