diff options
| author | Richard M. Stallman | 1997-07-31 07:54:07 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-07-31 07:54:07 +0000 |
| commit | 72dcef0e0ec7c1757ebe92fb5913caee99d6bc5f (patch) | |
| tree | 3eb33bba0a65cc471edf59260fe3282644b1a032 /src/filelock.c | |
| parent | 05e94d325c942a7d977e327193a32ecf5b109665 (diff) | |
| download | emacs-72dcef0e0ec7c1757ebe92fb5913caee99d6bc5f.tar.gz emacs-72dcef0e0ec7c1757ebe92fb5913caee99d6bc5f.zip | |
(current_lock_owner): Don't try to delete lock
if this or another existing process owns it!
Diffstat (limited to 'src/filelock.c')
| -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) | |||
| 240 | { | 240 | { |
| 241 | if (owner->pid == getpid ()) | 241 | if (owner->pid == getpid ()) |
| 242 | ret = 2; /* We own it. */ | 242 | ret = 2; /* We own it. */ |
| 243 | 243 | else if (owner->pid > 0 | |
| 244 | if (owner->pid > 0 | ||
| 245 | && (kill (owner->pid, 0) >= 0 || errno == EPERM)) | 244 | && (kill (owner->pid, 0) >= 0 || errno == EPERM)) |
| 246 | ret = 1; /* An existing process on this machine owns it. */ | 245 | ret = 1; /* An existing process on this machine owns it. */ |
| 247 | |||
| 248 | /* The owner process is dead or has a strange pid (<=0), so try to | 246 | /* The owner process is dead or has a strange pid (<=0), so try to |
| 249 | zap the lockfile. */ | 247 | zap the lockfile. */ |
| 250 | if (unlink (lfname) < 0) | 248 | else if (unlink (lfname) < 0) |
| 251 | ret = -1; | 249 | ret = -1; |
| 252 | 250 | else | |
| 253 | ret = 0; | 251 | ret = 0; |
| 254 | } | 252 | } |
| 255 | else | 253 | else |
| 256 | { /* If we wanted to support the check for stale locks on remote machines, | 254 | { /* If we wanted to support the check for stale locks on remote machines, |