emacs-diffs
[Top][All Lists]
Advanced

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

master e65be8c: Fix bug with lock file on nonstandard filesystem


From: Paul Eggert
Subject: master e65be8c: Fix bug with lock file on nonstandard filesystem
Date: Wed, 30 Oct 2019 21:15:58 -0400 (EDT)

branch: master
commit e65be8cc5b623385ebe31aa0a1089e0de2b075b5
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Fix bug with lock file on nonstandard filesystem
    
    * src/filelock.c (create_lock_file):
    Don’t disable user write access to the lock file (Bug#37884).
---
 src/filelock.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/filelock.c b/src/filelock.c
index ff25d64..2077287 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -402,9 +402,15 @@ create_lock_file (char *lfname, char *lock_info_str, bool 
force)
          ptrdiff_t lock_info_len;
          lock_info_len = strlen (lock_info_str);
          err = 0;
+
+         /* Make the lock file readable to others, so that others' sessions
+            can read it.  Even though nobody should write to the lock file,
+            keep it user-writable to work around problems on nonstandard file
+            systems that prohibit unlinking readonly files (Bug#37884).  */
          if (emacs_write (fd, lock_info_str, lock_info_len) != lock_info_len
-             || fchmod (fd, S_IRUSR | S_IRGRP | S_IROTH) != 0)
+             || fchmod (fd, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) != 0)
            err = errno;
+
          /* There is no need to call fsync here, as the contents of
             the lock file need not survive system crashes.  */
          if (emacs_close (fd) != 0)



reply via email to

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