42131c
diff -up libtirpc-0.2.4/src/svc_vc.c.orig libtirpc-0.2.4/src/svc_vc.c
42131c
--- libtirpc-0.2.4/src/svc_vc.c.orig	2018-12-17 10:54:46.174307476 -0500
42131c
+++ libtirpc-0.2.4/src/svc_vc.c	2018-12-17 11:00:53.841166947 -0500
42131c
@@ -494,9 +494,14 @@ read_vc(xprtp, buf, len)
42131c
 	cfp = (struct cf_conn *)xprt->xp_p1;
42131c
 
42131c
 	if (cfp->nonblock) {
42131c
+		/* Since len == 0 is returned on zero length
42131c
+		 * read or EOF errno needs to be reset before
42131c
+		 * the read
42131c
+		 */
42131c
+		errno = 0;
42131c
 		len = read(sock, buf, (size_t)len);
42131c
 		if (len < 0) {
42131c
-			if (errno == EAGAIN)
42131c
+			if (errno == EAGAIN || errno == EWOULDBLOCK)
42131c
 				len = 0;
42131c
 			else
42131c
 				goto fatal_err;
42131c
diff -up libtirpc-0.2.4/src/xdr_rec.c.orig libtirpc-0.2.4/src/xdr_rec.c
42131c
--- libtirpc-0.2.4/src/xdr_rec.c.orig	2013-12-09 15:59:51.000000000 -0500
42131c
+++ libtirpc-0.2.4/src/xdr_rec.c	2018-12-17 11:00:53.842166963 -0500
42131c
@@ -63,6 +63,7 @@
42131c
 #include <rpc/svc.h>
42131c
 #include <rpc/clnt.h>
42131c
 #include <stddef.h>
42131c
+#include <errno.h>
42131c
 #include "rpc_com.h"
42131c
 static bool_t	xdrrec_getlong(XDR *, long *);
42131c
 static bool_t	xdrrec_putlong(XDR *, const long *);
42131c
@@ -539,7 +540,13 @@ __xdrrec_getrec(xdrs, statp, expectdata)
42131c
 		n = rstrm->readit(rstrm->tcp_handle, rstrm->in_hdrp,
42131c
 		    (int)sizeof (rstrm->in_header) - rstrm->in_hdrlen);
42131c
 		if (n == 0) {
42131c
-			*statp = expectdata ? XPRT_DIED : XPRT_IDLE;
42131c
+			/* EAGAIN or EWOULDBLOCK means a zero length
42131c
+			 * read not an EOF.
42131c
+			 */
42131c
+			if (errno == EAGAIN || errno == EWOULDBLOCK)
42131c
+				*statp = XPRT_IDLE;
42131c
+			else
42131c
+				*statp = expectdata ? XPRT_DIED : XPRT_IDLE;
42131c
 			return FALSE;
42131c
 		}
42131c
 		if (n < 0) {
42131c
@@ -566,6 +573,7 @@ __xdrrec_getrec(xdrs, statp, expectdata)
42131c
 			rstrm->in_header &= ~LAST_FRAG;
42131c
 			rstrm->last_frag = TRUE;
42131c
 		}
42131c
+		rstrm->in_haveheader = 1;
42131c
 	}
42131c
 
42131c
 	n =  rstrm->readit(rstrm->tcp_handle,
42131c
@@ -578,7 +586,13 @@ __xdrrec_getrec(xdrs, statp, expectdata)
42131c
 	}
42131c
 
42131c
 	if (n == 0) {
42131c
-		*statp = expectdata ? XPRT_DIED : XPRT_IDLE;
42131c
+		/* EAGAIN or EWOULDBLOCK means a zero length
42131c
+		 * read not an EOF.
42131c
+		 */
42131c
+		if (errno == EAGAIN || errno == EWOULDBLOCK)
42131c
+			*statp = XPRT_IDLE;
42131c
+		else
42131c
+			*statp = expectdata ? XPRT_DIED : XPRT_IDLE;
42131c
 		return FALSE;
42131c
 	}
42131c