diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2020-01-20 01:08:42 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2020-01-20 01:21:52 -0800 |
commit | b3ad638a60845f17938ff812efcf2b2edfbd8c57 (patch) | |
tree | da4d1f416f9e06fe7f3e3318dd7127a39d812bec /src/filelock.c | |
parent | 6cc1db8174bcbe4fabc3627505a7d945cae7029d (diff) | |
download | emacs-b3ad638a60845f17938ff812efcf2b2edfbd8c57.tar.gz |
Work better if stat etc. are interrupted
Quit or retry if fstat, lstat, stat or openat fail with EINTR.
This should fix some bugs on platforms where accessing files via
NFS can fail that way (Bug#9256).
* src/dired.c (file_attributes):
* src/fileio.c (file_directory_p) [O_PATH]:
Use emacs_openat instead of openat.
* src/dired.c (file_attributes): Use emacs_fstatat instead of fstatat.
* src/fileio.c (barf_or_query_if_file_exists, Frename_file):
* src/filelock.c (rename_lock_file):
Use emacs_fstatat instead of lstat.
* src/fileio.c (file_directory_p, Ffile_regular_p, Ffile_modes)
(Ffile_newer_than_file_p, Fverify_visited_file_modtime)
(Fset_visited_file_modtime, auto_save_1):
* src/lread.c (Fload):
* src/sysdep.c (get_current_dir_name_or_unreachable):
Use emacs_fstatat instead of stat.
* src/sysdep.c (emacs_fstatat, emacs_openat): New functions.
(emacs_open): Redo in terms of emacs_open.
Diffstat (limited to 'src/filelock.c')
-rw-r--r-- | src/filelock.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/filelock.c b/src/filelock.c index b28f16e9b5a..73202f0b2c4 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -347,7 +347,8 @@ rename_lock_file (char const *old, char const *new, bool force) potential race condition since some other process may create NEW immediately after the existence check, but it's the best we can portably do here. */ - if (lstat (new, &st) == 0 || errno == EOVERFLOW) + if (emacs_fstatat (AT_FDCWD, new, &st, AT_SYMLINK_NOFOLLOW) == 0 + || errno == EOVERFLOW) { errno = EEXIST; return -1; |