diff options
author | Nikita Ivanov <nivanov@cloudlinux.com> | 2022-10-23 12:04:22 +0300 |
---|---|---|
committer | Thomas Huth <thuth@redhat.com> | 2023-01-09 13:50:47 +0100 |
commit | 37b0b24e933c18269dddbf6b83f91823cacf8105 (patch) | |
tree | b36ac8d45a9e188604e44998974d27cf6185e0f3 /tests | |
parent | 8b6aa69365ca6e9bbc3bf557a6ccc5ed2b468bec (diff) |
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>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/qtest/libqtest.c | 4 | ||||
-rw-r--r-- | tests/vhost-user-bridge.c | 4 |
2 files changed, 2 insertions, 6 deletions
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index f9c8987678..5cb38f90da 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -689,9 +689,7 @@ int qtest_socket_server(const char *socket_path) addr.sun_family = AF_UNIX; snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", socket_path); - do { - ret = bind(sock, (struct sockaddr *)&addr, sizeof(addr)); - } while (ret == -1 && errno == EINTR); + ret = RETRY_ON_EINTR(bind(sock, (struct sockaddr *)&addr, sizeof(addr))); g_assert_cmpint(ret, !=, -1); ret = listen(sock, 1); g_assert_cmpint(ret, !=, -1); diff --git a/tests/vhost-user-bridge.c b/tests/vhost-user-bridge.c index fecdf915e7..a5c711b1de 100644 --- a/tests/vhost-user-bridge.c +++ b/tests/vhost-user-bridge.c @@ -331,9 +331,7 @@ vubr_backend_recv_cb(int sock, void *ctx) .msg_iovlen = num, .msg_flags = MSG_DONTWAIT, }; - do { - ret = recvmsg(vubr->backend_udp_sock, &msg, 0); - } while (ret == -1 && (errno == EINTR)); + ret = RETRY_ON_EINTR(recvmsg(vubr->backend_udp_sock, &msg, 0)); if (i == 0) { iov_restore_front(elem->in_sg, sg, hdrlen); |