diff options
| author | Paul Eggert <eggert@cs.ucla.edu> | 2024-08-15 20:10:53 -0700 |
|---|---|---|
| committer | Paul Eggert <eggert@cs.ucla.edu> | 2024-08-15 20:11:33 -0700 |
| commit | 40eecd594ac60f38b6729fd9cf3474a8b9d133b9 (patch) | |
| tree | db7043923f69461bfcc40ce72a5f5b5bae5722f7 /lib-src | |
| parent | 8b36bfc553b97cf435bdfe1b84abe21c3a605b9f (diff) | |
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.c | 2 | ||||
| -rw-r--r-- | lib-src/update-game-score.c | 2 |
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) if (fclose (dst_f) == EOF) pfatal (dst_file); - if (unlink (src_file) == -1) + if (unlink (src_file) < 0 && errno != ENOENT) pfatal ("unlink error"); 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) char *lockpath = (char *) state; int saved_errno = errno; int ret = unlink (lockpath); - if (0 <= ret) + if (! (ret < 0 && errno != ENOENT)) errno = saved_errno; free (lockpath); return ret; |
