[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/23] tests: replace pipe() with g_unix_open_pipe(CLOEXEC)
From: |
marcandre . lureau |
Subject: |
[PULL 10/23] tests: replace pipe() with g_unix_open_pipe(CLOEXEC) |
Date: |
Tue, 3 May 2022 17:12:43 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
tests/qtest/ivshmem-test.c | 5 +++--
tests/unit/test-io-channel-file.c | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/tests/qtest/ivshmem-test.c b/tests/qtest/ivshmem-test.c
index bfc91d1719d2..e23a97fa8ef4 100644
--- a/tests/qtest/ivshmem-test.c
+++ b/tests/qtest/ivshmem-test.c
@@ -304,6 +304,7 @@ static void setup_vm_with_server(IVState *s, int nvectors)
static void test_ivshmem_server(void)
{
+ g_autoptr(GError) err = NULL;
IVState state1, state2, *s1, *s2;
ServerThread thread;
IvshmemServer server;
@@ -320,8 +321,8 @@ static void test_ivshmem_server(void)
g_assert_cmpint(ret, ==, 0);
thread.server = &server;
- ret = pipe(thread.pipe);
- g_assert_cmpint(ret, ==, 0);
+ g_unix_open_pipe(thread.pipe, FD_CLOEXEC, &err);
+ g_assert_no_error(err);
thread.thread = g_thread_new("ivshmem-server", server_thread, &thread);
g_assert(thread.thread != NULL);
diff --git a/tests/unit/test-io-channel-file.c
b/tests/unit/test-io-channel-file.c
index 29038e67b64d..1977006ce922 100644
--- a/tests/unit/test-io-channel-file.c
+++ b/tests/unit/test-io-channel-file.c
@@ -109,7 +109,7 @@ static void test_io_channel_pipe(bool async)
QIOChannelTest *test;
int fd[2];
- if (pipe(fd) < 0) {
+ if (!g_unix_open_pipe(fd, FD_CLOEXEC, NULL)) {
perror("pipe");
abort();
}
--
2.36.0.44.g0f828332d5ac
- [PULL 15/23] io: make qio_channel_command_new_pid() static, (continued)
- [PULL 15/23] io: make qio_channel_command_new_pid() static, marcandre . lureau, 2022/05/03
- [PULL 11/23] os-posix: replace pipe()+cloexec with g_unix_open_pipe(CLOEXEC), marcandre . lureau, 2022/05/03
- [PULL 00/23] Misc patches, marcandre . lureau, 2022/05/03
- [PULL 19/23] hw: replace qemu_set_nonblock(), marcandre . lureau, 2022/05/03
- [PULL 09/23] qga: replace pipe() with g_unix_open_pipe(CLOEXEC), marcandre . lureau, 2022/05/03
- Re: [PULL 00/23] Misc patches, Richard Henderson, 2022/05/03
- [PULL 11/23] os-posix: replace pipe()+cloexec with g_unix_open_pipe(CLOEXEC), marcandre . lureau, 2022/05/03
- [PULL 03/23] tests: move libqtest.h back under qtest/, marcandre . lureau, 2022/05/03
- [PULL 01/23] Use QEMU_SANITIZE_THREAD, marcandre . lureau, 2022/05/03
- [PULL 15/23] io: make qio_channel_command_new_pid() static, marcandre . lureau, 2022/05/03
- [PULL 10/23] tests: replace pipe() with g_unix_open_pipe(CLOEXEC),
marcandre . lureau <=
- [PULL 18/23] qga: replace qemu_set_nonblock(), marcandre . lureau, 2022/05/03
- [PULL 16/23] chardev: replace qemu_set_nonblock(), marcandre . lureau, 2022/05/03
- [PULL 07/23] Replace qemu_pipe() with g_unix_open_pipe(), marcandre . lureau, 2022/05/03
- [PULL 02/23] Use QEMU_SANITIZE_ADDRESS, marcandre . lureau, 2022/05/03
- [PULL 14/23] Replace fcntl(O_NONBLOCK) with g_unix_set_fd_nonblocking(), marcandre . lureau, 2022/05/03
- [PULL 06/23] block: move fcntl_setfl(), marcandre . lureau, 2022/05/03
- [PULL 04/23] libqtest: split QMP part in libqmp, marcandre . lureau, 2022/05/03
- [PULL 21/23] net: replace qemu_set_nonblock(), marcandre . lureau, 2022/05/03
- [PULL 23/23] util: rename qemu_*block() socket functions, marcandre . lureau, 2022/05/03
- [PULL 05/23] Use g_unix_set_fd_nonblocking(), marcandre . lureau, 2022/05/03