diff options
author | Richard M. Stallman <rms@gnu.org> | 1997-07-31 07:54:07 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1997-07-31 07:54:07 +0000 |
commit | 0d46505c2741ffe44418bccd7a1ff4253fccc8df (patch) | |
tree | 7b0b9e43dabc146779e259ac6b059dc81c47dfc4 | |
parent | f5d92b0e566d1feab2a0611f650a407df56acaf2 (diff) | |
download | emacs-0d46505c2741ffe44418bccd7a1ff4253fccc8df.tar.gz |
(current_lock_owner): Don't try to delete lock
if this or another existing process owns it!
-rw-r--r-- | src/filelock.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/filelock.c b/src/filelock.c index b79bccc65a5..6116b89fd96 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -240,17 +240,15 @@ current_lock_owner (owner, lfname) { if (owner->pid == getpid ()) ret = 2; /* We own it. */ - - if (owner->pid > 0 + else if (owner->pid > 0 && (kill (owner->pid, 0) >= 0 || errno == EPERM)) ret = 1; /* An existing process on this machine owns it. */ - /* The owner process is dead or has a strange pid (<=0), so try to zap the lockfile. */ - if (unlink (lfname) < 0) + else if (unlink (lfname) < 0) ret = -1; - - ret = 0; + else + ret = 0; } else { /* If we wanted to support the check for stale locks on remote machines, |