[CRIU] [PATCH v2] page-xfer: Don't expect that page server cmd is read in one call

Pavel Emelyanov xemul at parallels.com
Tue Mar 4 09:44:10 PST 2014


There's a standard way of doing this -- the MSG_WAITALL flag that
works even for TCP sockets.

Signed-off-by: Pavel Emelyanov <xemul at parallels.com>

---

diff --git a/page-xfer.c b/page-xfer.c
index f13b0ac..01b9b72 100644
--- a/page-xfer.c
+++ b/page-xfer.c
@@ -167,7 +167,7 @@ static int page_server_serve(int sk)
 	while (1) {
 		struct page_server_iov pi;
 
-		ret = read(sk, &pi, sizeof(pi));
+		ret = recv(sk, &pi, sizeof(pi), MSG_WAITALL);
 		if (!ret)
 			break;
 


More information about the CRIU mailing list