aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@redhat.com>2021-12-25 00:45:04 +0100
committerThomas Huth <thuth@redhat.com>2022-01-05 11:10:13 +0100
commit585507017c956e6695ef4ee760440dc6153ed5cd (patch)
treece6eba321be70b1126072ebf171ccf9a47ba442e /tests
parent961fb4b465800318792047de2339292f3ac37fa6 (diff)
downloadqemu-585507017c956e6695ef4ee760440dc6153ed5cd.zip
qemu-585507017c956e6695ef4ee760440dc6153ed5cd.tar.gz
qemu-585507017c956e6695ef4ee760440dc6153ed5cd.tar.bz2
tests/unit/test-util-sockets: Use g_file_open_tmp() to create temp file
Similarly to commit e63ed64c6d1 ("tests/qtest/virtio-net-failover: Use g_file_open_tmp() to create temporary file"), avoid calling g_test_rand_int() before g_test_init(): use g_file_open_tmp(). Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20211224234504.3413370-1-philmd@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test-util-sockets.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/unit/test-util-sockets.c b/tests/unit/test-util-sockets.c
index 72b9246..896247e 100644
--- a/tests/unit/test-util-sockets.c
+++ b/tests/unit/test-util-sockets.c
@@ -305,9 +305,11 @@ static void test_socket_unix_abstract(void)
};
int i;
+ i = g_file_open_tmp("unix-XXXXXX", &addr.u.q_unix.path, NULL);
+ g_assert_true(i >= 0);
+ close(i);
+
addr.type = SOCKET_ADDRESS_TYPE_UNIX;
- addr.u.q_unix.path = g_strdup_printf("unix-%d-%u",
- getpid(), g_random_int());
addr.u.q_unix.has_abstract = true;
addr.u.q_unix.abstract = true;
addr.u.q_unix.has_tight = false;