nano

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

commit a6365707c06ffb9df22158b1e224bef4bab4974a
parent 6fad6a17da7c84d30e1e1af8940784786fe9d4aa
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Thu, 17 Oct 2019 16:43:07 +0200

tweaks: remove the superfluous closing of a file descriptor

The file itself is closed three lines earlier; this also closes the
corresponding descriptor.

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

diff --git a/src/files.c b/src/files.c @@ -832,12 +832,11 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable) /* If there was a real error during the reading, let the user know. */ if (ferror(f) && errornumber != EINTR && errornumber != 0) statusline(ALERT, strerror(errornumber)); + fclose(f); - if (fd > 0 && !undoable) { - close(fd); + if (fd > 0 && !undoable) writable = (ISSET(VIEW_MODE) || access(filename, W_OK) == 0); - } /* If the file ended with newline, or it was entirely empty, make the * last line blank. Otherwise, put the last read data in. */