The branch main has been updated by stevek: URL: https://cgit.FreeBSD.org/src/commit/?id=ce9c3abf69c2044c1aab0aa62e4a73f8eb13d787
commit ce9c3abf69c2044c1aab0aa62e4a73f8eb13d787 Author: Stephen J. Kiernan <ste...@freebsd.org> AuthorDate: 2024-09-18 19:49:46 +0000 Commit: Stephen J. Kiernan <ste...@freebsd.org> CommitDate: 2024-09-18 19:49:46 +0000 config: Search include paths for files to be read (options, files) This is useful for downstream consumers to add their own kernel config files in another directory other than the default ones. Obtained from: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D44538 --- usr.sbin/config/mkmakefile.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/usr.sbin/config/mkmakefile.cc b/usr.sbin/config/mkmakefile.cc index 060f08230550..a102b2b59767 100644 --- a/usr.sbin/config/mkmakefile.cc +++ b/usr.sbin/config/mkmakefile.cc @@ -384,13 +384,25 @@ read_file(char *fname) struct file_list *tp; struct device *dp; struct opt *op; + struct includepath *ipath; configword wd; - char *rfile, *compilewith, *depends, *clean, *warning; + char *rfile, *compilewith, *depends, *clean, *fnamebuf, *warning; const char *objprefix; int compile, match, nreqs, std, filetype, negate, imp_rule, no_ctfconvert, no_obj, before_depend, nowerror; fp = fopen(fname, "r"); + if (fp == NULL) { + SLIST_FOREACH(ipath, &includepath, path_next) { + asprintf(&fnamebuf, "%s/%s", ipath->path, fname); + if (fnamebuf != NULL) { + fp = fopen(fnamebuf, "r"); + if (fp != NULL) + break; + free(fnamebuf); + } + } + } if (fp == NULL) err(1, "%s", fname); next: