changeset 19058:96413dc296fe

(current_lock_owner): Don't try to delete lock if this or another existing process owns it!
author Richard M. Stallman <rms@gnu.org>
date Thu, 31 Jul 1997 07:54:07 +0000
parents b1251bcaaa0e
children 06cb7a02a079
files src/filelock.c
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/filelock.c	Thu Jul 31 06:59:37 1997 +0000
+++ b/src/filelock.c	Thu Jul 31 07:54:07 1997 +0000
@@ -240,17 +240,15 @@
     {
       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,