aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorPaul Eggert2024-08-15 20:10:53 -0700
committerPaul Eggert2024-08-15 20:11:33 -0700
commit40eecd594ac60f38b6729fd9cf3474a8b9d133b9 (patch)
treedb7043923f69461bfcc40ce72a5f5b5bae5722f7 /lib-src
parent8b36bfc553b97cf435bdfe1b84abe21c3a605b9f (diff)
downloademacs-40eecd594ac60f38b6729fd9cf3474a8b9d133b9.tar.gz
emacs-40eecd594ac60f38b6729fd9cf3474a8b9d133b9.zip
Port better to NFS unlink
I found this problem while looking into Bug#72641. * lib-src/etags.c (do_move_file): * lib-src/update-game-score.c (unlock_file): * src/androidvfs.c (android_hack_asset_fd_fallback): * src/filelock.c (current_lock_owner): Treat unlink as successful if it fails because the file wasn’t there. This can happen with some NFS implementations, due to its retrying over the network to get at-least-once semantics. Although most of Emacs’s calls to unlink were already doing this, a few instances were not.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/etags.c2
-rw-r--r--lib-src/update-game-score.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 03bc55de03d..edadbc25901 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -7812,7 +7812,7 @@ do_move_file (const char *src_file, const char *dst_file)
7812 if (fclose (dst_f) == EOF) 7812 if (fclose (dst_f) == EOF)
7813 pfatal (dst_file); 7813 pfatal (dst_file);
7814 7814
7815 if (unlink (src_file) == -1) 7815 if (unlink (src_file) < 0 && errno != ENOENT)
7816 pfatal ("unlink error"); 7816 pfatal ("unlink error");
7817 7817
7818 return; 7818 return;
diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c
index 4139073bcd7..e3b24ad7717 100644
--- a/lib-src/update-game-score.c
+++ b/lib-src/update-game-score.c
@@ -497,7 +497,7 @@ unlock_file (const char *filename, void *state)
497 char *lockpath = (char *) state; 497 char *lockpath = (char *) state;
498 int saved_errno = errno; 498 int saved_errno = errno;
499 int ret = unlink (lockpath); 499 int ret = unlink (lockpath);
500 if (0 <= ret) 500 if (! (ret < 0 && errno != ENOENT))
501 errno = saved_errno; 501 errno = saved_errno;
502 free (lockpath); 502 free (lockpath);
503 return ret; 503 return ret;