files: exclude the call of fsync() from the tiny version

To avoid a spurious error message when the user chooses to write
the current buffer to a fifo.

Reported-by: André Kugland <kugland@gmail.com>
  https://lists.gnu.org/archive/html/nano-devel/2021-09/msg00031.html
master
Benno Schulenberg 2021-09-28 10:57:50 +02:00
parent 9ab49658d7
commit b07fb5a811
1 changed files with 1 additions and 1 deletions

View File

@ -1961,13 +1961,13 @@ bool write_file(const char *name, FILE *thefile, bool tmp,
}
if (!is_existing_file || !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));
fclose(thefile);
goto cleanup_and_exit;
}
#endif
if (fclose(thefile) != 0) {
statusline(ALERT, _("Error writing %s: %s"), realname, strerror(errno));