daemon.py: Silence return warning.
authorEthan Jackson <ethan@nicira.com>
Fri, 16 Sep 2011 23:46:18 +0000 (16:46 -0700)
committerEthan Jackson <ethan@nicira.com>
Sat, 17 Sep 2011 01:27:33 +0000 (18:27 -0700)
Pychecker complains about __read_pidfile() having too may returns.
I personally think the function is fine, but it's easy enough to
reduce them.

python/ovs/daemon.py:395: Function (__read_pidfile) has too many
returns (12)

python/ovs/daemon.py

index 5b9b06ac2d960c30c5ba6b523069c81477b0e2cb..184e7832fc264f8d0bf52dd2df8d56d7c5695a2b 100644 (file)
@@ -457,13 +457,15 @@ def __read_pidfile(pidfile, delete_if_stale):
     # Someone else has the pidfile locked.
     try:
         try:
-            return int(file_handle.readline())
+            error = int(file_handle.readline())
         except IOError, e:
             logging.warning("%s: read: %s" % (pidfile, e.strerror))
-            return -e.errno
+            error = -e.errno
         except ValueError:
             logging.warning("%s does not contain a pid" % pidfile)
-            return -errno.EINVAL
+            error = -errno.EINVAL
+
+        return error
     finally:
         try:
             file_handle.close()