From ab3cfa4a17663cf479f286149a2289974dd67240 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 18 Dec 2022 11:45:06 -0800 Subject: [PATCH 1/2] =?UTF-8?q?Don=E2=80=99t=20hang=20when=20copying=20FIF?= =?UTF-8?q?Os?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * src/fileio.c (Fcopy_file): Open the input file with O_NONBLOCK. This prevents a hang if the input file is a FIFO. If it’s a regular file O_NONBLOCK has no effect; otherwise the file is soon rejected anyway. --- src/fileio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fileio.c b/src/fileio.c index 92335b639c..a50f8d67c1 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2219,7 +2219,7 @@ DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 6, report_file_error ("Copying permissions to", newname); } #else /* not WINDOWSNT */ - ifd = emacs_open (SSDATA (encoded_file), O_RDONLY, 0); + ifd = emacs_open (SSDATA (encoded_file), O_RDONLY | O_NONBLOCK, 0); if (ifd < 0) report_file_error ("Opening input file", file); -- 2.38.1