diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-08-01 23:26:22 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-08-10 10:27:11 +0200 |
commit | bc9ddf987d3c454e1cdca29f44508914a0f5f5d5 (patch) | |
tree | bf42c21eba99ba22da0018026ec3e3bce14cf628 /src | |
parent | f92a1a5c4a8761c39a76b264859f0ff2c8f71179 (diff) |
scanner: don't fall back on current directory if include is not found
This resolves an ambiguity if the same file name is used both under
sysconfdir and the current working directory. You can use dot slash
./ to explicitly refer to files in the current working directory.
Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1040
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/scanner.l | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/scanner.l b/src/scanner.l index 6f1a5512..cb2ea320 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -639,16 +639,15 @@ int scanner_include_file(void *scanner, const char *filename, if (f != NULL) break; } - } - if (f == NULL) { + } else { f = fopen(filename, "r"); - if (f == NULL) { - erec = error(loc, "Could not open file \"%s\": %s\n", - filename, strerror(errno)); - goto err; - } name = filename; } + if (f == NULL) { + erec = error(loc, "Could not open file \"%s\": %s\n", + filename, strerror(errno)); + goto err; + } erec = scanner_push_file(scanner, name, f, loc); if (erec != NULL) |