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