emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 7546179a01: Don't hang on trying to rename FIFOs between file sys


From: Lars Ingebrigtsen
Subject: master 7546179a01: Don't hang on trying to rename FIFOs between file systems
Date: Sun, 8 May 2022 10:13:10 -0400 (EDT)

branch: master
commit 7546179a011452c304022349d034a03303a11ebb
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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).
---
 src/fileio.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/fileio.c b/src/fileio.c
index c418036fc6..0610f7235a 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);
     }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]