python socket_util: Don't try to unbind None bind_path.
authorBen Pfaff <blp@nicira.com>
Wed, 7 Mar 2012 23:38:27 +0000 (15:38 -0800)
committerBen Pfaff <blp@nicira.com>
Thu, 8 Mar 2012 00:33:14 +0000 (16:33 -0800)
This bug is not exposed in the current tree, because no existing caller
passes None as bind_path.

Signed-off-by: Ben Pfaff <blp@nicira.com>
python/ovs/socket_util.py

index 83c82046e903515078c20a084157fc3c4b63fead..0a26c5de6164bf6fa68443412b86c9b43a3f23d2 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2010 Nicira Networks
+# Copyright (c) 2010, 2012 Nicira Networks
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -69,11 +69,11 @@ def make_unix_socket(style, nonblock, bind_path, connect_path):
         return 0, sock
     except socket.error, e:
         sock.close()
-        try:
-            os.unlink(bind_path)
-        except OSError, e:
-            pass
         if bind_path is not None:
+            try:
+                os.unlink(bind_path)
+            except OSError, e:
+                pass
             ovs.fatal_signal.add_file_to_unlink(bind_path)
         return get_exception_errno(e), None