From: Paul Eggert Date: Sun, 18 Dec 2022 19:45:06 +0000 (-0800) Subject: Don’t hang when copying FIFOs X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ab3cfa4a17663cf479f286149a2289974dd67240;p=emacs.git Don’t hang when copying FIFOs * 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. --- diff --git a/src/fileio.c b/src/fileio.c index 92335b639cd..a50f8d67c11 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2219,7 +2219,7 @@ permissions. */) 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);