]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
test/relay: do not hardcode /tmp on !unix
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 24 Mar 2022 11:39:44 +0000 (15:39 +0400)
committerSimon McVittie <smcv@collabora.com>
Fri, 15 Jul 2022 15:26:54 +0000 (16:26 +0100)
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
test/relay.c

index 044260afa975da1e3fe66f509dcffb3983265f0a..77a4084980be9840c983a2be0ada9761a9c1a75a 100644 (file)
@@ -338,6 +338,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);
 
@@ -349,15 +355,17 @@ main (int argc,
       test_limit, teardown);
 
 #ifdef DBUS_UNIX
-  g_test_add ("/connect/unix", Fixture, "unix:tmpdir=/tmp", setup,
+  g_test_add ("/connect/unix", Fixture, unix_tmpdir, setup,
       test_connect, teardown);
-  g_test_add ("/relay/unix", Fixture, "unix:tmpdir=/tmp", setup,
+  g_test_add ("/relay/unix", Fixture, unix_tmpdir, setup,
       test_relay, teardown);
-  g_test_add ("/limit/unix", Fixture, "unix:tmpdir=/tmp", setup,
+  g_test_add ("/limit/unix", Fixture, unix_tmpdir, setup,
       test_limit, teardown);
 #endif
 
   ret = g_test_run ();
   dbus_shutdown ();
+  g_free (unix_tmpdir);
+  dbus_free (tmp);
   return ret;
 }