[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master ab3cfa4a17 1/2: Don’t hang when copying FIFOs
From: |
Paul Eggert |
Subject: |
master ab3cfa4a17 1/2: Don’t hang when copying FIFOs |
Date: |
Sun, 18 Dec 2022 16:05:03 -0500 (EST) |
branch: master
commit ab3cfa4a17663cf479f286149a2289974dd67240
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>
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.
---
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 @@ 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);