diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2022-05-08 15:41:46 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-05-08 16:13:04 +0200 |
commit | 7546179a011452c304022349d034a03303a11ebb (patch) | |
tree | 935d1ff25ad2e5f11935621b073d9b7bff318870 | |
parent | d6e316db729718f93772cec2e5166f54a920c0e3 (diff) | |
download | emacs-7546179a011452c304022349d034a03303a11ebb.tar.gz |
Don't hang on trying to rename FIFOs between file systems
* src/fileio.c (Frename_file): Don't hang on trying to move FIFOs
(bug#34069).
-rw-r--r-- | src/fileio.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/fileio.c b/src/fileio.c index c418036fc6e..0610f7235a5 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2718,6 +2718,20 @@ This is what happens in interactive use with M-x. */) : Qnil); if (!NILP (symlink_target)) Fmake_symbolic_link (symlink_target, newname, ok_if_already_exists); + else if (S_ISFIFO (file_st.st_mode)) + { + /* If it's a FIFO, calling `copy-file' will hang if it's a + inter-file system move, so do it here. (It will signal + an error in that case, but it won't hang in any case.) */ + if (!NILP (ok_if_already_exists)) + barf_or_query_if_file_exists (newname, false, + "rename to it", + FIXNUMP (ok_if_already_exists), + false); + if (rename (SSDATA (encoded_file), SSDATA (encoded_newname)) != 0) + report_file_errno ("Renaming", list2 (file, newname), errno); + return Qnil; + } else Fcopy_file (file, newname, ok_if_already_exists, Qt, Qt, Qt); } |