diff options
| -rw-r--r-- | src/filelock.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/filelock.c b/src/filelock.c index c68aacc46fb..1ae57dc7344 100644 --- a/src/filelock.c +++ b/src/filelock.c | |||
| @@ -397,8 +397,8 @@ current_lock_owner (lock_info_type *owner, Lisp_Object lfname) | |||
| 397 | if (lfinfolen < 0) | 397 | if (lfinfolen < 0) |
| 398 | return errno == ENOENT || errno == ENOTDIR ? 0 : errno; | 398 | return errno == ENOENT || errno == ENOTDIR ? 0 : errno; |
| 399 | 399 | ||
| 400 | /* Examine lock file contents. */ | 400 | /* If the lock file seems valid, return a value based on its contents. */ |
| 401 | if (true) | 401 | if (lfinfolen) |
| 402 | { | 402 | { |
| 403 | if (MAX_LFINFO < lfinfolen) | 403 | if (MAX_LFINFO < lfinfolen) |
| 404 | return ENAMETOOLONG; | 404 | return ENAMETOOLONG; |
| @@ -496,8 +496,11 @@ current_lock_owner (lock_info_type *owner, Lisp_Object lfname) | |||
| 496 | return ANOTHER_OWNS_IT; | 496 | return ANOTHER_OWNS_IT; |
| 497 | } | 497 | } |
| 498 | 498 | ||
| 499 | /* The owner process is dead or has a strange pid. | 499 | /* The owner process is dead or has a strange pid, or the lock file is empty. |
| 500 | Try to zap the lockfile. */ | 500 | Try to zap the lockfile. If the lock file is empty, this assumes |
| 501 | the file system is buggy, e.g., <https://bugs.gnu.org/72641>. | ||
| 502 | Emacs never creates empty lock files even temporarily, so removing | ||
| 503 | an empty lock file should be harmless. */ | ||
| 501 | return emacs_unlink (SSDATA (lfname)) < 0 ? errno : 0; | 504 | return emacs_unlink (SSDATA (lfname)) < 0 ? errno : 0; |
| 502 | } | 505 | } |
| 503 | 506 | ||