From 31e1af646c18f15e04b06c7b7b19d99f72170db4 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 23 Dec 2015 16:44:39 +0000 Subject: [PATCH] Not opening an extra blank buffer when an empty file is read. This bug was exposed by r5498 on December 18. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5511 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 ++ src/files.c | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7a8c4ed9..21749e5f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,8 @@ offer ^Q to close and discard the buffer without saving it. By default, the key is bound only when --tempfile is in effect. * doc/man/nanorc.5: Improve ordering of bindable functions. + * src/files.c (read_file): Don't open an extra blank buffer when + an empty file is read. Bug was exposed by r5498, December 18. 2015-12-23 Mike Frysinger * doc/syntax/autoconf.nanorc: Handle .m4 files too, add the "elif" diff --git a/src/files.c b/src/files.c index 490efa25..61f4d15c 100644 --- a/src/files.c +++ b/src/files.c @@ -784,11 +784,6 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkw free(buf); - /* If we didn't get a file and we don't already have one, open a - * blank buffer. */ - if (fileptr == NULL) - open_buffer("", FALSE); - /* Attach the file we got to the filestruct. If we got a file of * zero bytes, don't do anything. */ if (num_lines > 0) {