From 9ab49658d731e1506942cdf7c96ebd6a90858956 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 28 Sep 2021 10:05:23 +0200 Subject: [PATCH] files: prepending to a fifo makes no sense, so do not try that Trying to prepend would hang nano until some other process writes something to the fifo. This fixes https://savannah.gnu.org/bugs/?61236. Bug existed since before version 2.2.4. --- src/files.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/files.c b/src/files.c index c951559a..b27d5a84 100644 --- a/src/files.c +++ b/src/files.c @@ -1799,6 +1799,11 @@ bool write_file(const char *name, FILE *thefile, bool tmp, goto cleanup_and_exit; } + if (method == PREPEND && is_existing_file && S_ISFIFO(st.st_mode)) { + statusline(ALERT, _("Error writing %s: %s"), realname, "FIFO"); + goto cleanup_and_exit; + } + /* When prepending, first copy the existing file to a temporary file. */ if (method == PREPEND) { FILE *source = fopen(realname, "rb");