nano

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

commit 7db5c2f22578358e87856a3ca638f1958d7190b3
parent 603ce231d01a45d4f33eb78e23466c0e0c370601
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Wed,  6 Apr 2022 16:37:52 +0200

files: when the working directory exists, still check its accessibility

This fixes https://savannah.gnu.org/bugs/?62258.

Bug existed since commit 940b5eaa from yesterday.

Diffstat:
Msrc/files.c | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/files.c b/src/files.c @@ -350,14 +350,17 @@ bool has_valid_path(const char *filename) char *parentdir = dirname(namecopy); struct stat parentinfo; bool validity = FALSE; + bool gone = FALSE; if (strcmp(parentdir, ".") == 0) { char *currentdir = realpath(".", NULL); - if (currentdir == NULL) - statusline(ALERT, _("The working directory has disappeared")); - + gone = (currentdir == NULL && errno == ENOENT); free(currentdir); + } + + if (gone) { + statusline(ALERT, _("The working directory has disappeared")); } else if (stat(parentdir, &parentinfo) == -1) { if (errno == ENOENT) /* TRANSLATORS: Keep the next ten messages at most 76 characters. */