]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wpaspy: Be a bit more careful on detaching the control interface
authorJouni Malinen <jouni@codeaurora.org>
Mon, 1 Jun 2020 19:24:00 +0000 (22:24 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 1 Jun 2020 19:25:12 +0000 (22:25 +0300)
Check that the client socket is still open before trying to detach the
control interface to avoid undesired exceptions on cleanup paths on
unexpected errors due to the socket getting closed.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
wpaspy/wpaspy.py

index 89e973b984ef6f84540a073906659f8345c96dab..c50cd531e10906ca559e727b97cc6996bd600369 100644 (file)
@@ -113,6 +113,9 @@ class Ctrl:
     def detach(self):
         if not self.attached:
             return None
+        if self.s.fileno() == -1:
+            self.attached = False
+            return None
         while self.pending():
             ev = self.recv()
         res = self.request("DETACH")