]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
test/server-oom: do not hardcode /tmp
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 24 Mar 2022 11:42:05 +0000 (15:42 +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/internals/server-oom.c

index dc3127fa569f611ff40d29baaaeb78f21c9ff8df..7414ece86a5a42b1275f2a274cb732a5980bf5f2 100644 (file)
@@ -131,6 +131,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);
 
@@ -140,12 +146,14 @@ main (int argc,
   add_oom_test ("/server/new-tcp-star", test_new_server, "tcp:host=127.0.0.1,bind=*");
   add_oom_test ("/server/new-tcp-v4", test_new_server, "tcp:host=127.0.0.1,bind=127.0.0.1,family=ipv4");
 #ifdef DBUS_UNIX
-  add_oom_test ("/server/unix", test_new_server, "unix:tmpdir=/tmp");
+  add_oom_test ("/server/unix", test_new_server, unix_tmpdir);
 #endif
 
   ret = g_test_run ();
 
   g_queue_free_full (test_cases_to_free, g_free);
   dbus_shutdown ();
+  g_free (unix_tmpdir);
+  dbus_free (tmp);
   return ret;
 }