diff options
author | asomers <asomers@FreeBSD.org> | 2014-03-20 17:30:09 +0000 |
---|---|---|
committer | asomers <asomers@FreeBSD.org> | 2014-03-20 17:30:09 +0000 |
commit | 1b1437fc8fbe4fe40af7cae92335a35aec85d9bc (patch) | |
tree | 83f15c7ab1120080020260d8f604bcf3b9f155a7 /usr.sbin/config/main.c | |
parent | f0be5aaf9653563d6904cb6fd04a30ebd924329f (diff) | |
download | FreeBSD-src-1b1437fc8fbe4fe40af7cae92335a35aec85d9bc.zip FreeBSD-src-1b1437fc8fbe4fe40af7cae92335a35aec85d9bc.tar.gz |
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).
PR: kern/187712
Reviewed by: will, imp (previous version)
MFC after: 3 weeks
Sponsored by: Spectra Logic Corporation
Diffstat (limited to 'usr.sbin/config/main.c')
-rw-r--r-- | usr.sbin/config/main.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c index 78bb13d..86ecfa6 100644 --- a/usr.sbin/config/main.c +++ b/usr.sbin/config/main.c @@ -110,15 +110,25 @@ main(int argc, char **argv) int ch, len; char *p; char *kernfile; + struct includepath* ipath; int printmachine; printmachine = 0; kernfile = NULL; - while ((ch = getopt(argc, argv, "Cd:gmpVx:")) != -1) + SLIST_INIT(&includepath); + while ((ch = getopt(argc, argv, "CI:d:gmpVx:")) != -1) switch (ch) { case 'C': filebased = 1; break; + case 'I': + ipath = (struct includepath *) \ + calloc(1, sizeof (struct includepath)); + if (ipath == NULL) + err(EXIT_FAILURE, "calloc"); + ipath->path = optarg; + SLIST_INSERT_HEAD(&includepath, ipath, path_next); + break; case 'm': printmachine = 1; break; |