diff options
| author | Paul Eggert | 2019-10-30 18:15:14 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-10-30 18:15:53 -0700 |
| commit | e65be8cc5b623385ebe31aa0a1089e0de2b075b5 (patch) | |
| tree | c21f10ee7462b758e60a04f314406d271e64e521 /src/filelock.c | |
| parent | 48fdfd8b939654e5bde0ef5448e17e4336cdb229 (diff) | |
| download | emacs-e65be8cc5b623385ebe31aa0a1089e0de2b075b5.tar.gz emacs-e65be8cc5b623385ebe31aa0a1089e0de2b075b5.zip | |
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).
Diffstat (limited to 'src/filelock.c')
| -rw-r--r-- | src/filelock.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/filelock.c b/src/filelock.c index ff25d6475de..2077287345c 100644 --- a/src/filelock.c +++ b/src/filelock.c | |||
| @@ -402,9 +402,15 @@ create_lock_file (char *lfname, char *lock_info_str, bool force) | |||
| 402 | ptrdiff_t lock_info_len; | 402 | ptrdiff_t lock_info_len; |
| 403 | lock_info_len = strlen (lock_info_str); | 403 | lock_info_len = strlen (lock_info_str); |
| 404 | err = 0; | 404 | err = 0; |
| 405 | |||
| 406 | /* Make the lock file readable to others, so that others' sessions | ||
| 407 | can read it. Even though nobody should write to the lock file, | ||
| 408 | keep it user-writable to work around problems on nonstandard file | ||
| 409 | systems that prohibit unlinking readonly files (Bug#37884). */ | ||
| 405 | if (emacs_write (fd, lock_info_str, lock_info_len) != lock_info_len | 410 | if (emacs_write (fd, lock_info_str, lock_info_len) != lock_info_len |
| 406 | || fchmod (fd, S_IRUSR | S_IRGRP | S_IROTH) != 0) | 411 | || fchmod (fd, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) != 0) |
| 407 | err = errno; | 412 | err = errno; |
| 413 | |||
| 408 | /* There is no need to call fsync here, as the contents of | 414 | /* There is no need to call fsync here, as the contents of |
| 409 | the lock file need not survive system crashes. */ | 415 | the lock file need not survive system crashes. */ |
| 410 | if (emacs_close (fd) != 0) | 416 | if (emacs_close (fd) != 0) |