diff options
author | peter <peter@FreeBSD.org> | 2002-04-27 22:32:57 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2002-04-27 22:32:57 +0000 |
commit | cc7a68c868d5e86840533d81c70944fd3896aaea (patch) | |
tree | 7f4ed44393ba3035995417987c828bcd2d3aa510 /sys/kern/subr_hints.c | |
parent | c204fdd4f35985b73b3a29324df99a58531faec2 (diff) | |
download | FreeBSD-src-cc7a68c868d5e86840533d81c70944fd3896aaea.zip FreeBSD-src-cc7a68c868d5e86840533d81c70944fd3896aaea.tar.gz |
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...
Diffstat (limited to 'sys/kern/subr_hints.c')
-rw-r--r-- | sys/kern/subr_hints.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sys/kern/subr_hints.c b/sys/kern/subr_hints.c index 2784564..919106e 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) |