Blame SOURCES/amanda-3.3.3-non-blocking-connection-2.patch

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