nano

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

commit 9ab49658d731e1506942cdf7c96ebd6a90858956
parent bb3d367716561ad6cfa5e6599ce5ac6a8e33ac15
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Tue, 28 Sep 2021 10:05:23 +0200

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.

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

diff --git 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");