From 0abf22512961e6bc3bb334d1f6618a94d60f0989 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Tue, 4 Apr 2017 12:21:43 +0200
Subject: [PATCH] files: check also for write errors when prepending, not just
 read errors

---
 src/files.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/files.c b/src/files.c
index df2627c3..105ed65f 100644
--- a/src/files.c
+++ b/src/files.c
@@ -1979,7 +1979,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
 	    goto cleanup_and_exit;
 	}
 
-	if (copy_file(f_source, f, TRUE) == -1) {
+	if (copy_file(f_source, f, TRUE) != 0) {
 	    statusline(ALERT, _("Error writing %s: %s"), realname,
 			strerror(errno));
 	    goto cleanup_and_exit;
-- 
GitLab