From a19d2e7f09b5d0bc527fa09a5eeeea45b852aa2e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 17 Mar 2022 17:13:26 +0400 Subject: [PATCH] tests/corrupt: do not hardcode /tmp on !unix MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau --- test/corrupt.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/corrupt.c b/test/corrupt.c index 758084a40..767103b57 100644 --- a/test/corrupt.c +++ b/test/corrupt.c @@ -406,6 +406,12 @@ main (int argc, char **argv) { int ret; +#ifdef DBUS_UNIX + char *tmp = _dbus_strdup ("/tmp"); +#else + char *tmp = dbus_address_escape_value (g_get_tmp_dir ()); +#endif + gchar *unix_tmpdir = g_strdup_printf ("unix:tmpdir=%s", tmp); test_init (&argc, &argv); @@ -413,7 +419,7 @@ main (int argc, test_corrupt, teardown); #ifdef DBUS_UNIX - g_test_add ("/corrupt/unix", Fixture, "unix:tmpdir=/tmp", setup, + g_test_add ("/corrupt/unix", Fixture, unix_tmpdir, setup, test_corrupt, teardown); #endif @@ -421,11 +427,14 @@ main (int argc, test_byte_order, teardown); #ifdef DBUS_UNIX - g_test_add ("/corrupt/byte-order/unix", Fixture, "unix:tmpdir=/tmp", setup, + g_test_add ("/corrupt/byte-order/unix", Fixture, unix_tmpdir, setup, test_byte_order, teardown); #endif ret = g_test_run (); dbus_shutdown (); + + g_free (unix_tmpdir); + dbus_free (tmp); return ret; } -- 2.47.3