aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2022-04-25 11:56:42 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2022-05-03 15:47:38 +0400
commit22e135fca3f2512f43d39efab49067660e365e1b (patch)
tree11bdfaec65d018ab43269a916d8233f566262381 /tests
parentd640b59eb3c7925568c5b101f439b0c0e65ea313 (diff)
downloadqemu-22e135fca3f2512f43d39efab49067660e365e1b.zip
qemu-22e135fca3f2512f43d39efab49067660e365e1b.tar.gz
qemu-22e135fca3f2512f43d39efab49067660e365e1b.tar.bz2
Replace fcntl(O_NONBLOCK) with g_unix_set_fd_nonblocking()
Suggested-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/qtest/fuzz/virtio_net_fuzz.c2
-rw-r--r--tests/unit/test-iov.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/tests/qtest/fuzz/virtio_net_fuzz.c b/tests/qtest/fuzz/virtio_net_fuzz.c
index 3df78d9..c2c15f0 100644
--- a/tests/qtest/fuzz/virtio_net_fuzz.c
+++ b/tests/qtest/fuzz/virtio_net_fuzz.c
@@ -151,7 +151,7 @@ static void *virtio_net_test_setup_socket(GString *cmd_line, void *arg)
{
int ret = socketpair(PF_UNIX, SOCK_STREAM, 0, sockfds);
g_assert_cmpint(ret, !=, -1);
- fcntl(sockfds[0], F_SETFL, O_NONBLOCK);
+ g_unix_set_fd_nonblocking(sockfds[0], true, NULL);
sockfds_initialized = true;
g_string_append_printf(cmd_line, " -netdev socket,fd=%d,id=hs0 ",
sockfds[1]);
diff --git a/tests/unit/test-iov.c b/tests/unit/test-iov.c
index 0d2ba9b..93bda00 100644
--- a/tests/unit/test-iov.c
+++ b/tests/unit/test-iov.c
@@ -186,7 +186,7 @@ static void test_io(void)
close(sv[0]);
FD_SET(sv[1], &fds);
- fcntl(sv[1], F_SETFL, O_RDWR|O_NONBLOCK);
+ g_unix_set_fd_nonblocking(sv[1], true, NULL);
r = g_test_rand_int_range(sz / 2, sz);
setsockopt(sv[1], SOL_SOCKET, SO_SNDBUF, &r, sizeof(r));
@@ -220,7 +220,7 @@ static void test_io(void)
close(sv[1]);
FD_SET(sv[0], &fds);
- fcntl(sv[0], F_SETFL, O_RDWR|O_NONBLOCK);
+ g_unix_set_fd_nonblocking(sv[0], true, NULL);
r = g_test_rand_int_range(sz / 2, sz);
setsockopt(sv[0], SOL_SOCKET, SO_RCVBUF, &r, sizeof(r));
usleep(500000);