diff options
author | 1998-06-12 12:17:08 +0000 | |
---|---|---|
committer | 1998-06-12 12:17:08 +0000 | |
commit | 6a74c60dade70cbcb175c028d60885d7cf1b8f04 (patch) | |
tree | e3112701d855b8f7eae3046631467e8c78154022 | |
parent | describe bug about faking EOF (diff) | |
download | wireguard-openbsd-6a74c60dade70cbcb175c028d60885d7cf1b8f04.tar.xz wireguard-openbsd-6a74c60dade70cbcb175c028d60885d7cf1b8f04.zip |
warn when ../../../ appears in include directive, since includes are relative to srcdir and kludge code is still active.
-rw-r--r-- | usr.sbin/config/scan.l | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.sbin/config/scan.l b/usr.sbin/config/scan.l index d52885cdabb..0f0def6d756 100644 --- a/usr.sbin/config/scan.l +++ b/usr.sbin/config/scan.l @@ -1,5 +1,5 @@ %{ -/* $OpenBSD: scan.l,v 1.10 1998/05/18 12:25:12 art Exp $ */ +/* $OpenBSD: scan.l,v 1.11 1998/06/12 12:17:08 d Exp $ */ /* $NetBSD: scan.l,v 1.13 1997/02/02 21:12:37 thorpej Exp $ */ /* @@ -208,15 +208,18 @@ include(fname, ateof) char *s; static int havedirs; + /* XXX Kludge until files.* files are fixed. */ + if (strncmp(fname, "../../../", 9) == 0) { + error("leading ../../../ should be removed from include \"%s\"", fname); + errors--; + fname += 9; + } + if (havedirs == 0) { havedirs = 1; setupdirs(); } - /* Kludge until files.* files are fixed. */ - if (strncmp(fname, "../../../", 9) == 0) - fname += 9; - s = (*fname == '/') ? strdup(fname) : sourcepath(fname); if ((fp = fopen(s, "r")) == NULL) { error("cannot open %s for reading: %s\n", s, strerror(errno)); |