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)