mirror of
https://github.com/mii443/qemu.git
synced 2025-12-03 11:08:25 +00:00
error handling: Use RETRY_ON_EINTR() macro where applicable
There is a defined RETRY_ON_EINTR() macro in qemu/osdep.h which handles the same while loop. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/415 Signed-off-by: Nikita Ivanov <nivanov@cloudlinux.com> Message-Id: <20221023090422.242617-3-nivanov@cloudlinux.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> [thuth: Dropped the hunk that changed socket_accept() in libqtest.c] Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
committed by
Thomas Huth
parent
8b6aa69365
commit
37b0b24e93
17
net/l2tpv3.c
17
net/l2tpv3.c
@@ -240,9 +240,7 @@ static ssize_t net_l2tpv3_receive_dgram_iov(NetClientState *nc,
|
||||
message.msg_control = NULL;
|
||||
message.msg_controllen = 0;
|
||||
message.msg_flags = 0;
|
||||
do {
|
||||
ret = sendmsg(s->fd, &message, 0);
|
||||
} while ((ret == -1) && (errno == EINTR));
|
||||
ret = RETRY_ON_EINTR(sendmsg(s->fd, &message, 0));
|
||||
if (ret > 0) {
|
||||
ret -= s->offset;
|
||||
} else if (ret == 0) {
|
||||
@@ -285,9 +283,7 @@ static ssize_t net_l2tpv3_receive_dgram(NetClientState *nc,
|
||||
message.msg_control = NULL;
|
||||
message.msg_controllen = 0;
|
||||
message.msg_flags = 0;
|
||||
do {
|
||||
ret = sendmsg(s->fd, &message, 0);
|
||||
} while ((ret == -1) && (errno == EINTR));
|
||||
ret = RETRY_ON_EINTR(sendmsg(s->fd, &message, 0));
|
||||
if (ret > 0) {
|
||||
ret -= s->offset;
|
||||
} else if (ret == 0) {
|
||||
@@ -434,12 +430,9 @@ static void net_l2tpv3_send(void *opaque)
|
||||
|
||||
msgvec = s->msgvec + s->queue_head;
|
||||
if (target_count > 0) {
|
||||
do {
|
||||
count = recvmmsg(
|
||||
s->fd,
|
||||
msgvec,
|
||||
target_count, MSG_DONTWAIT, NULL);
|
||||
} while ((count == -1) && (errno == EINTR));
|
||||
count = RETRY_ON_EINTR(
|
||||
recvmmsg(s->fd, msgvec, target_count, MSG_DONTWAIT, NULL)
|
||||
);
|
||||
if (count < 0) {
|
||||
/* Recv error - we still need to flush packets here,
|
||||
* (re)set queue head to current position
|
||||
|
||||
Reference in New Issue
Block a user