tests: replace pipe() with g_unix_open_pipe(CLOEXEC)
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>
This commit is contained in:
parent
ed78331dda
commit
89810e10ed
@ -304,6 +304,7 @@ static void setup_vm_with_server(IVState *s, int nvectors)
|
|||||||
|
|
||||||
static void test_ivshmem_server(void)
|
static void test_ivshmem_server(void)
|
||||||
{
|
{
|
||||||
|
g_autoptr(GError) err = NULL;
|
||||||
IVState state1, state2, *s1, *s2;
|
IVState state1, state2, *s1, *s2;
|
||||||
ServerThread thread;
|
ServerThread thread;
|
||||||
IvshmemServer server;
|
IvshmemServer server;
|
||||||
@ -320,8 +321,8 @@ static void test_ivshmem_server(void)
|
|||||||
g_assert_cmpint(ret, ==, 0);
|
g_assert_cmpint(ret, ==, 0);
|
||||||
|
|
||||||
thread.server = &server;
|
thread.server = &server;
|
||||||
ret = pipe(thread.pipe);
|
g_unix_open_pipe(thread.pipe, FD_CLOEXEC, &err);
|
||||||
g_assert_cmpint(ret, ==, 0);
|
g_assert_no_error(err);
|
||||||
thread.thread = g_thread_new("ivshmem-server", server_thread, &thread);
|
thread.thread = g_thread_new("ivshmem-server", server_thread, &thread);
|
||||||
g_assert(thread.thread != NULL);
|
g_assert(thread.thread != NULL);
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ static void test_io_channel_pipe(bool async)
|
|||||||
QIOChannelTest *test;
|
QIOChannelTest *test;
|
||||||
int fd[2];
|
int fd[2];
|
||||||
|
|
||||||
if (pipe(fd) < 0) {
|
if (!g_unix_open_pipe(fd, FD_CLOEXEC, NULL)) {
|
||||||
perror("pipe");
|
perror("pipe");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user