Blame SOURCES/libtirpc-0.2.4-nonblocking-mode.patch

8dd2ab
commit a4fa582908b9c63957240cb0cb68b59d56244ef5
8dd2ab
Author: Bodo Stroesser <bstroesser@ts.fujitsu.com>
8dd2ab
Date:   Thu Nov 6 13:26:00 2014 -0500
8dd2ab
8dd2ab
    write_vc: fix write retry loop for nonblocking mode
8dd2ab
    
8dd2ab
    This is a simple fix for the write retry loop that is used on
8dd2ab
    non-blocking connections if write() failed with -EAGAIN.
8dd2ab
    
8dd2ab
    Additionally it removes a redundant if () {}
8dd2ab
    
8dd2ab
    Erroneously at each cycle of the loop the length of the data
8dd2ab
    to send is incremented and the buffer pointer is decremented.
8dd2ab
    Thus, it might happen that:
8dd2ab
    * the application crashes
8dd2ab
    * data from the memory before the buffer is sent
8dd2ab
    
8dd2ab
    Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com>
8dd2ab
    Signed-off-by: Steve Dickson <steved@redhat.com>
8dd2ab
8dd2ab
diff --git a/src/svc_vc.c b/src/svc_vc.c
8dd2ab
index 4c70de8..4d3ea51 100644
8dd2ab
--- a/src/svc_vc.c
8dd2ab
+++ b/src/svc_vc.c
8dd2ab
@@ -559,20 +559,19 @@ write_vc(xprtp, buf, len)
8dd2ab
 				cd->strm_stat = XPRT_DIED;
8dd2ab
 				return (-1);
8dd2ab
 			}
8dd2ab
-			if (cd->nonblock && i != cnt) {
8dd2ab
-				/*
8dd2ab
-				 * For non-blocking connections, do not
8dd2ab
-				 * take more than 2 seconds writing the
8dd2ab
-				 * data out.
8dd2ab
-				 *
8dd2ab
-				 * XXX 2 is an arbitrary amount.
8dd2ab
-				 */
8dd2ab
-				gettimeofday(&tv1, NULL);
8dd2ab
-				if (tv1.tv_sec - tv0.tv_sec >= 2) {
8dd2ab
-					cd->strm_stat = XPRT_DIED;
8dd2ab
-					return (-1);
8dd2ab
-				}
8dd2ab
+			/*
8dd2ab
+			 * For non-blocking connections, do not
8dd2ab
+			 * take more than 2 seconds writing the
8dd2ab
+			 * data out.
8dd2ab
+			 *
8dd2ab
+			 * XXX 2 is an arbitrary amount.
8dd2ab
+			 */
8dd2ab
+			gettimeofday(&tv1, NULL);
8dd2ab
+			if (tv1.tv_sec - tv0.tv_sec >= 2) {
8dd2ab
+				cd->strm_stat = XPRT_DIED;
8dd2ab
+				return (-1);
8dd2ab
 			}
8dd2ab
+			i = 0; /* Don't change buf and cnt */
8dd2ab
 		}
8dd2ab
 	}
8dd2ab