From a2b20a19152b764b099a32392110b927a28f4292 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 27 Sep 2021 17:15:57 +0200 Subject: [PATCH] files: do not call fsync() on a fifo, to avoid a spurious error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes https://savannah.gnu.org/bugs/?61234. The original report was in: https://lists.gnu.org/archive/html/nano-devel/2021-09/msg00029.html Reported-by: André Kugland Bug existed since version 5.0, commit a84cdaaa. --- src/files.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/files.c b/src/files.c index a9d833bd..a0ccfbc8 100644 --- a/src/files.c +++ b/src/files.c @@ -1953,8 +1953,9 @@ bool write_file(const char *name, FILE *thefile, bool tmp, unlink(tempname); } -#endif + if (!S_ISFIFO(st.st_mode)) +#endif /* Ensure the data has reached the disk before reporting it as written. */ if (fflush(thefile) != 0 || fsync(fileno(thefile)) != 0) { statusline(ALERT, _("Error writing %s: %s"), realname, strerror(errno));