diff options
| author | Paul Eggert | 2024-08-15 20:10:53 -0700 |
|---|---|---|
| committer | Paul Eggert | 2024-08-15 20:11:33 -0700 |
| commit | 40eecd594ac60f38b6729fd9cf3474a8b9d133b9 (patch) | |
| tree | db7043923f69461bfcc40ce72a5f5b5bae5722f7 /src | |
| parent | 8b36bfc553b97cf435bdfe1b84abe21c3a605b9f (diff) | |
| download | emacs-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 'src')
| -rw-r--r-- | src/androidvfs.c | 2 | ||||
| -rw-r--r-- | src/filelock.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/androidvfs.c b/src/androidvfs.c index 14da8eed37e..ff81ef288f5 100644 --- a/src/androidvfs.c +++ b/src/androidvfs.c | |||
| @@ -1323,7 +1323,7 @@ android_hack_asset_fd_fallback (AAsset *asset) | |||
| 1323 | if (fd < 0) | 1323 | if (fd < 0) |
| 1324 | return -1; | 1324 | return -1; |
| 1325 | 1325 | ||
| 1326 | if (unlink (filename)) | 1326 | if (unlink (filename) && errno != ENOENT) |
| 1327 | goto fail; | 1327 | goto fail; |
| 1328 | 1328 | ||
| 1329 | if (ftruncate (fd, size)) | 1329 | if (ftruncate (fd, size)) |
diff --git a/src/filelock.c b/src/filelock.c index 1ae57dc7344..bc09fce69f8 100644 --- a/src/filelock.c +++ b/src/filelock.c | |||
| @@ -501,7 +501,7 @@ current_lock_owner (lock_info_type *owner, Lisp_Object lfname) | |||
| 501 | the file system is buggy, e.g., <https://bugs.gnu.org/72641>. | 501 | the file system is buggy, e.g., <https://bugs.gnu.org/72641>. |
| 502 | Emacs never creates empty lock files even temporarily, so removing | 502 | Emacs never creates empty lock files even temporarily, so removing |
| 503 | an empty lock file should be harmless. */ | 503 | an empty lock file should be harmless. */ |
| 504 | return emacs_unlink (SSDATA (lfname)) < 0 ? errno : 0; | 504 | return emacs_unlink (SSDATA (lfname)) < 0 && errno != ENOENT ? errno : 0; |
| 505 | } | 505 | } |
| 506 | 506 | ||
| 507 | 507 | ||