diff options
| author | 2007-11-26 17:25:59 +0000 | |
|---|---|---|
| committer | 2007-11-26 17:25:59 +0000 | |
| commit | 6e4ac6a53f9d80a4375bc38bc035b15bdb31da3b (patch) | |
| tree | d28b0af64759c9d3e0cef36a08f978b319e9a5fc | |
| parent | discard still-born support for .o files in the "file" command.. (diff) | |
| download | wireguard-openbsd-6e4ac6a53f9d80a4375bc38bc035b15bdb31da3b.tar.xz wireguard-openbsd-6e4ac6a53f9d80a4375bc38bc035b15bdb31da3b.zip | |
Put the converted filename into the makefiles, so that we can later support
variables make(1) does not natively convert in the same way.
| -rw-r--r-- | usr.sbin/config/mkmakefile.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c index 96fd364c9cc..920c479712e 100644 --- a/usr.sbin/config/mkmakefile.c +++ b/usr.sbin/config/mkmakefile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkmakefile.c,v 1.24 2007/11/26 17:24:24 deraadt Exp $ */ +/* $OpenBSD: mkmakefile.c,v 1.25 2007/11/26 17:25:59 deraadt Exp $ */ /* $NetBSD: mkmakefile.c,v 1.34 1997/02/02 21:12:36 thorpej Exp $ */ /* @@ -150,9 +150,10 @@ bad: static const char * srcpath(struct files *fi) { + /* Always have source, don't support object dirs for kernel builds. */ struct nvlist *nv, *nv1; + char *expand, *source; const char *var; - char *source; /* Search path list for files we will want to use */ if (fi->fi_nvpath->nv_next == NULL) { @@ -163,9 +164,9 @@ srcpath(struct files *fi) for (nv = fi->fi_nvpath; nv; nv = nv->nv_next) { char *s, *e; + expand = NULL; s = strchr(nv->nv_name, '$'); if (s) { - char *expand; size_t len; /* Search for a ${name} to expand */ @@ -190,11 +191,16 @@ srcpath(struct files *fi) s - nv->nv_name, s - nv->nv_name, nv->nv_name, var, e + 1); source = sourcepath(expand); - free(expand); } else source = sourcepath(nv->nv_name); - if (access(source, R_OK) == 0) + if (access(source, R_OK) == 0) { + /* poolalloc() prevents freeing old nv_name */ + if (expand) + nv->nv_name = intern(expand); break; + } + if (expand) + free(expand); free(source); } if (nv == NULL) |
