aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2022-12-18 11:45:06 -0800
committerPaul Eggert2022-12-18 13:04:53 -0800
commitab3cfa4a17663cf479f286149a2289974dd67240 (patch)
tree812cfbb2d3d484c6d2432200342404ad89f7789f /src
parent09b5f00613572dd27f43626aed21f3659d5ced64 (diff)
downloademacs-ab3cfa4a17663cf479f286149a2289974dd67240.tar.gz
emacs-ab3cfa4a17663cf479f286149a2289974dd67240.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/fileio.c2
1 files changed, 1 insertions, 1 deletions
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. */)
2219 report_file_error ("Copying permissions to", newname); 2219 report_file_error ("Copying permissions to", newname);
2220 } 2220 }
2221#else /* not WINDOWSNT */ 2221#else /* not WINDOWSNT */
2222 ifd = emacs_open (SSDATA (encoded_file), O_RDONLY, 0); 2222 ifd = emacs_open (SSDATA (encoded_file), O_RDONLY | O_NONBLOCK, 0);
2223 2223
2224 if (ifd < 0) 2224 if (ifd < 0)
2225 report_file_error ("Opening input file", file); 2225 report_file_error ("Opening input file", file);