aboutsummaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>2002-04-27 22:32:57 +0000
committerPeter Wemm <peter@FreeBSD.org>2002-04-27 22:32:57 +0000
commit4f033348f445cbd9929bf7297f07c1e160fdcce3 (patch)
tree7f4ed44393ba3035995417987c828bcd2d3aa510 /sys/kern
parentfc1218bb71f9ebf3b3f4506b69e654f0b40f97e0 (diff)
downloadsrc-4f033348f445cbd9929bf7297f07c1e160fdcce3.tar.gz
src-4f033348f445cbd9929bf7297f07c1e160fdcce3.zip
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...
Notes
Notes: svn path=/head/; revision=95593
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/subr_hints.c18
1 files changed, 10 insertions, 8 deletions
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)