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

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