From 592d0d6c9a5175c62aa12d4a4c6d4f260fcab490 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sat, 26 Nov 2016 16:55:06 +0100 Subject: [PATCH] files: trying to open a non-existent file will never succeed If it would, the returned file descriptor would make nano crash, because the corresponding stream has not been opened. And when returning zero instead (as the code did originally), nano would open an empty buffer, although it claims to be reading the file. In short: I think this is a leftover of an attempted fix of https://savannah.gnu.org/bugs/?25297, from commit 2823c99. --- src/files.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/files.c b/src/files.c index a4ac750e..34426b33 100644 --- a/src/files.c +++ b/src/files.c @@ -975,14 +975,6 @@ int open_file(const char *filename, bool newfie, bool quiet, FILE **f) /* All cases below return. */ free(full_filename); - /* Well, maybe we can open the file even if the OS says it's - * not there. */ - if ((fd = open(filename, O_RDONLY)) != -1) { - if (!quiet) - statusbar(_("Reading File")); - return fd; - } - if (newfie) { if (!quiet) statusbar(_("New File"));