[PATCH 1/1] wpa_ctrl: Retry select() on EINTR

Jörg Krause joerg.krause at embedded.rocks
Tue Jan 26 07:28:53 PST 2016


Retry select() if it was interrupted by a signal.

Signed-off-by: Jörg Krause <joerg.krause at embedded.rocks>
---
 src/common/wpa_ctrl.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/common/wpa_ctrl.c b/src/common/wpa_ctrl.c
index 5733aa6..783e6b0 100644
--- a/src/common/wpa_ctrl.c
+++ b/src/common/wpa_ctrl.c
@@ -532,8 +532,12 @@ retry_send:
 		FD_ZERO(&rfds);
 		FD_SET(ctrl->s, &rfds);
 		res = select(ctrl->s + 1, &rfds, NULL, NULL, &tv);
-		if (res < 0)
-			return res;
+		if (res < 0) {
+			if (errno == EINTR)
+				continue;
+			else
+				return res;
+		}
 		if (FD_ISSET(ctrl->s, &rfds)) {
 			res = recv(ctrl->s, reply, *reply_len, 0);
 			if (res < 0)
-- 
2.7.0



More information about the Hostap mailing list