Blob Blame History Raw
diff -urNp old/common-src/security-util.c new/common-src/security-util.c
--- old/common-src/security-util.c	2013-01-10 13:54:54.000000000 +0100
+++ new/common-src/security-util.c	2018-01-15 14:51:08.051123925 +0100
@@ -511,6 +511,17 @@ tcpm_recv_token(
 	rval = read(fd, ((char *)&rc->netint) + rc->size_header_read,
 		        SIZEOF(rc->netint) - rc->size_header_read);
 	if (rval == -1) {
+            if (0
+#ifdef EAGAIN
+		|| errno == EAGAIN
+#endif
+#ifdef EWOULDBLOCK
+		|| errno == EWOULDBLOCK
+#endif
+		) {
+		g_debug("first read return EAGAIN");
+		return -2;
+	    }
 	    if (errmsg)
 		*errmsg = newvstrallocf(*errmsg, _("recv error: %s"),
 					strerror(errno));
@@ -594,6 +605,17 @@ tcpm_recv_token(
     rval = read(fd, rc->buffer + rc->size_buffer_read,
 		    (size_t)*size - rc->size_buffer_read);
     if (rval == -1) {
+       if (0
+#ifdef EAGAIN
+                || errno == EAGAIN
+#endif
+#ifdef EWOULDBLOCK
+                || errno == EWOULDBLOCK
+#endif
+	    ) {
+	    g_debug("second read return EAGAIN");
+	    return -2;
+	}
 	if (errmsg)
 	    *errmsg = newvstrallocf(*errmsg, _("recv error: %s"),
 				    strerror(errno));