diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2023-02-16 16:43:10 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2023-02-16 18:56:35 +0100 |
commit | 83b2061ae7c7f0b3f3c85fa88a195c84fd9404c6 (patch) | |
tree | 8cbb7e81104973983d2afd686db455f2ef73b4f6 | |
parent | 42bfd212b1f3bb52c7781bea10022e1c1d9db5fc (diff) | |
download | passt-83b2061ae7c7f0b3f3c85fa88a195c84fd9404c6.tar passt-83b2061ae7c7f0b3f3c85fa88a195c84fd9404c6.tar.gz passt-83b2061ae7c7f0b3f3c85fa88a195c84fd9404c6.tar.bz2 passt-83b2061ae7c7f0b3f3c85fa88a195c84fd9404c6.tar.lz passt-83b2061ae7c7f0b3f3c85fa88a195c84fd9404c6.tar.xz passt-83b2061ae7c7f0b3f3c85fa88a195c84fd9404c6.tar.zst passt-83b2061ae7c7f0b3f3c85fa88a195c84fd9404c6.zip |
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 <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r-- | tcp.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -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; |