nano

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

commit 40c067133a4cafcd57d447c3b080eb036712433a
parent 36270748dcd3865cf88b01f9c3f8d194717d1422
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Wed, 16 Oct 2019 15:47:35 +0200

tweaks: remove two superfluous conditions when prepending

When prepending, we cannot be writing to a temp file,
so 'stream' (and thus 'f') will necessarily be NULL.

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

diff --git a/src/files.c b/src/files.c @@ -1724,7 +1724,6 @@ bool write_file(const char *name, FILE *stream, bool tmp, int fd_source; FILE *f_source = NULL; - if (f == NULL) { f = fopen(realname, "rb"); if (f == NULL) { @@ -1732,7 +1731,6 @@ bool write_file(const char *name, FILE *stream, bool tmp, strerror(errno)); goto cleanup_and_exit; } - } tempname = safe_tempfile(&f); @@ -1742,7 +1740,6 @@ bool write_file(const char *name, FILE *stream, bool tmp, goto cleanup_and_exit; } - if (stream == NULL) { fd_source = open(realname, O_RDONLY | O_CREAT, S_IRUSR | S_IWUSR); if (fd_source != -1) { @@ -1756,7 +1753,6 @@ bool write_file(const char *name, FILE *stream, bool tmp, goto cleanup_and_exit; } } - } if (f_source == NULL || copy_file(f_source, f, TRUE) != 0) { statusline(ALERT, _("Error writing temp file: %s"),