daemon: Stylistic improvement for __read_pidfile in Python implementation.
authorBen Pfaff <blp@nicira.com>
Mon, 22 Aug 2011 21:40:09 +0000 (14:40 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 24 Aug 2011 18:57:42 +0000 (11:57 -0700)
Suggested-by: Reid Price <reid@nicira.com>
python/ovs/daemon.py

index 5aa5bc10a27302eac372e5fff27c00e0475fafb7..da7eb8aed99035b34b87183a2a70e5f8104c84ea 100644 (file)
@@ -422,10 +422,10 @@ def __read_pidfile(pidfile, delete_if_stale):
             logging.warning("%s: failed to delete stale pidfile"
                             % (pidfile, e.strerror))
             return -e.errno
-
-        logging.debug("%s: deleted stale pidfile" % pidfile)
-        file.close()
-        return 0
+        else:
+            logging.debug("%s: deleted stale pidfile" % pidfile)
+            file.close()
+            return 0
     except IOError, e:
         if e.errno not in [errno.EACCES, errno.EAGAIN]:
             logging.warn("%s: fcntl: %s" % (pidfile, e.strerror))