rcfile: report an error when an included file does not exist
That is: do not silently return from parse_one_include() when the given file does not exist, *and* return the filename (or pattern) itself when it matches nothing. This fixes https://savannah.gnu.org/bugs/?63446. Bug existed since version 4.0, commit d3f0d32e.
This commit is contained in:
parent
846588ee81
commit
4b35626aec
@ -908,7 +908,7 @@ void parse_one_include(char *file, syntaxtype *syntax)
|
|||||||
FILE *rcstream;
|
FILE *rcstream;
|
||||||
|
|
||||||
/* Don't open directories, character files, or block files. */
|
/* Don't open directories, character files, or block files. */
|
||||||
if (!is_good_file(file))
|
if (access(file, R_OK) == 0 && !is_good_file(file))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rcstream = fopen(file, "rb");
|
rcstream = fopen(file, "rb");
|
||||||
@ -976,7 +976,7 @@ void parse_includes(char *ptr)
|
|||||||
|
|
||||||
/* Expand a tilde first, then try to match the globbing pattern. */
|
/* Expand a tilde first, then try to match the globbing pattern. */
|
||||||
expanded = real_dir_from_tilde(pattern);
|
expanded = real_dir_from_tilde(pattern);
|
||||||
result = glob(expanded, GLOB_ERR, NULL, &files);
|
result = glob(expanded, GLOB_ERR|GLOB_NOCHECK, NULL, &files);
|
||||||
|
|
||||||
/* If there are matches, process each of them. Otherwise, only
|
/* If there are matches, process each of them. Otherwise, only
|
||||||
* report an error if it's something other than zero matches. */
|
* report an error if it's something other than zero matches. */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user