diff options
author | asomers <asomers@FreeBSD.org> | 2014-04-10 19:51:33 +0000 |
---|---|---|
committer | asomers <asomers@FreeBSD.org> | 2014-04-10 19:51:33 +0000 |
commit | 2ab6848d6397c8c2d4f1df090f94496307c4af08 (patch) | |
tree | cdbeb9cf60fb322b42638c492b3f0c1f75f3ec64 /usr.sbin/config/lang.l | |
parent | 4ebc67638dcb114eea289b35532ed22d0588f5f8 (diff) | |
download | FreeBSD-src-2ab6848d6397c8c2d4f1df090f94496307c4af08.zip FreeBSD-src-2ab6848d6397c8c2d4f1df090f94496307c4af08.tar.gz |
MFC r263429
Fix kern/187712: config(8) does not respect KERNCONFDIR.
The impact of this bug is that you cannot build a kernel if both of the
following are true:
1) The kernel config file is in a non-default location
2) The kernel config file uses the "include" statement from config(5).
usr.sbin/config/main.c
usr.sbin/config/config.8
usr.sbin/config/config.h
usr.sbin/config/lang.l
Added a "-I path" option to config(8). By analogy to cc(1), it adds
an extra path in which the "include" statement will search for
files.
Makefile.inc1
Pass "-I ${KERNCONFDIR}" to config(8).
Diffstat (limited to 'usr.sbin/config/lang.l')
-rw-r--r-- | usr.sbin/config/lang.l | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/usr.sbin/config/lang.l b/usr.sbin/config/lang.l index 3e4e115..14fa7da 100644 --- a/usr.sbin/config/lang.l +++ b/usr.sbin/config/lang.l @@ -34,6 +34,7 @@ #include <assert.h> #include <ctype.h> #include <err.h> +#include <stdlib.h> #include <string.h> #include "y.tab.h" #include "config.h" @@ -257,6 +258,7 @@ include(const char *fname, int ateof) { FILE *fp; struct incl *in; + struct includepath* ipath; char *fnamebuf; fnamebuf = NULL; @@ -269,6 +271,17 @@ include(const char *fname, int ateof) } } if (fp == NULL) { + SLIST_FOREACH(ipath, &includepath, path_next) { + asprintf(&fnamebuf, "%s/%s", ipath->path, fname); + if (fnamebuf != NULL) { + fp = fopen(fnamebuf, "r"); + free(fnamebuf); + } + if (fp != NULL) + break; + } + } + if (fp == NULL) { yyerror("cannot open included file"); return (-1); } |