[CRIU] [PATCH 1/2] tcp: don't fail if send eats only a part of data

Andrey Vagin avagin at openvz.org
Fri Nov 21 06:10:55 PST 2014


For stream sockets it's possiable and we should not fail in this case.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 sk-tcp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sk-tcp.c b/sk-tcp.c
index eb6dd15..3ef7015 100644
--- a/sk-tcp.c
+++ b/sk-tcp.c
@@ -472,13 +472,13 @@ static int __send_tcp_queue(int sk, int queue, u32 len, struct cr_img *img)
 		int chunk = (len > max ? max : len);
 
 		ret = send(sk, buf + off, chunk, 0);
-		if (ret != chunk) {
+		if (ret <= 0) {
 			pr_perror("Can't restore %d queue data (%d), want (%d:%d)",
 				  queue, ret, chunk, len);
 			goto err;
 		}
-		off += chunk;
-		len -= chunk;
+		off += ret;
+		len -= ret;
 	}
 
 	err = 0;
-- 
1.9.3



More information about the CRIU mailing list