nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 4b35626aec704362119a0d1124e99b9e18e1ab7a
parent 846588ee81c781c9c28cce530aa9b6b150e27f37
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Fri,  2 Dec 2022 09:23:57 +0100

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.

Diffstat:
Msrc/rcfile.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/rcfile.c b/src/rcfile.c @@ -908,7 +908,7 @@ void parse_one_include(char *file, syntaxtype *syntax) FILE *rcstream; /* 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; rcstream = fopen(file, "rb"); @@ -976,7 +976,7 @@ void parse_includes(char *ptr) /* Expand a tilde first, then try to match the globbing 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 * report an error if it's something other than zero matches. */