aboutsummaryrefslogtreecommitdiffstats
path: root/wpaspy
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2013-12-31 13:43:17 (GMT)
committerJouni Malinen <j@w1.fi>2013-12-31 13:45:18 (GMT)
commitd52747c99e27d520a5f00f5207042f6f4bf0d838 (patch)
treee617c4aa6bf48daf6a5e3705034d32105e867a91 /wpaspy
parentb44db5f6d6698fe7cf7f603e3f99cfe169a8706d (diff)
downloadhostap-d52747c99e27d520a5f00f5207042f6f4bf0d838.zip
hostap-d52747c99e27d520a5f00f5207042f6f4bf0d838.tar.gz
hostap-d52747c99e27d520a5f00f5207042f6f4bf0d838.tar.bz2
wpaspy: Do not leave socket files behind if connection fails
Ctrl::__init__ needs to handle socket.connect() exceptions and unlink the client socket file on failures. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpaspy')
-rw-r--r--wpaspy/wpaspy.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/wpaspy/wpaspy.py b/wpaspy/wpaspy.py
index 9836c2d..7c2314d 100644
--- a/wpaspy/wpaspy.py
+++ b/wpaspy/wpaspy.py
@@ -22,7 +22,12 @@ class Ctrl:
self.local = "/tmp/wpa_ctrl_" + str(os.getpid()) + '-' + str(counter)
counter += 1
self.s.bind(self.local)
- self.s.connect(self.dest)
+ try:
+ self.s.connect(self.dest)
+ except Exception, e:
+ self.s.close()
+ os.unlink(self.local)
+ raise
self.started = True
def __del__(self):