Commit 72dcef0e authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(current_lock_owner): Don't try to delete lock

if this or another existing process owns it!
parent 05e94d32
...@@ -240,17 +240,15 @@ current_lock_owner (owner, lfname) ...@@ -240,17 +240,15 @@ current_lock_owner (owner, lfname)
{ {
if (owner->pid == getpid ()) if (owner->pid == getpid ())
ret = 2; /* We own it. */ ret = 2; /* We own it. */
else if (owner->pid > 0
if (owner->pid > 0
&& (kill (owner->pid, 0) >= 0 || errno == EPERM)) && (kill (owner->pid, 0) >= 0 || errno == EPERM))
ret = 1; /* An existing process on this machine owns it. */ ret = 1; /* An existing process on this machine owns it. */
/* The owner process is dead or has a strange pid (<=0), so try to /* The owner process is dead or has a strange pid (<=0), so try to
zap the lockfile. */ zap the lockfile. */
if (unlink (lfname) < 0) else if (unlink (lfname) < 0)
ret = -1; ret = -1;
else
ret = 0; ret = 0;
} }
else else
{ /* If we wanted to support the check for stale locks on remote machines, { /* If we wanted to support the check for stale locks on remote machines,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment