From: Jouni Malinen Date: Mon, 1 Jun 2020 19:24:00 +0000 (+0300) Subject: wpaspy: Be a bit more careful on detaching the control interface X-Git-Tag: hostap_2_10~1233 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=30885edb7e89a97cd30593a0043eab303683e341;p=thirdparty%2Fhostap.git wpaspy: Be a bit more careful on detaching the control interface 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 --- diff --git a/wpaspy/wpaspy.py b/wpaspy/wpaspy.py index 89e973b98..c50cd531e 100644 --- a/wpaspy/wpaspy.py +++ b/wpaspy/wpaspy.py @@ -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")