From 83b2061ae7c7f0b3f3c85fa88a195c84fd9404c6 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Thu, 16 Feb 2023 16:43:10 +1100 Subject: tcp: Remove 'recvmsg' goto from tcp_data_from_sock This goto can be handled just as simply and more clearly with a do while. Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- tcp.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tcp.c b/tcp.c index 32ce1e9..d289f10 100644 --- a/tcp.c +++ b/tcp.c @@ -2186,13 +2186,12 @@ static int tcp_data_from_sock(struct ctx *c, struct tcp_tap_conn *conn) iov_sock[fill_bufs].iov_len = iov_rem; /* Receive into buffers, don't dequeue until acknowledged by guest. */ -recvmsg: - len = recvmsg(s, &mh_sock, MSG_PEEK); - if (len < 0) { - if (errno == EINTR) - goto recvmsg; + do + len = recvmsg(s, &mh_sock, MSG_PEEK); + while (len < 0 && errno == EINTR); + + if (len < 0) goto err; - } if (!len) goto zero_len; -- cgit v1.2.3