]> git.proxmox.com Git - mirror_qemu.git/commitdiff
tests/unit: test-qga: Avoid using hardcoded /tmp
authorBin Meng <bin.meng@windriver.com>
Sun, 25 Sep 2022 11:30:01 +0000 (19:30 +0800)
committerThomas Huth <thuth@redhat.com>
Tue, 27 Sep 2022 18:51:20 +0000 (20:51 +0200)
This case was written to use hardcoded /tmp directory for temporary
files. Update to use g_get_tmp_dir() for a portable implementation.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-24-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
tests/unit/test-qga.c

index b6ea7c7304c3af8498d186b6b8890afacc9297cd..b4e0a145737d1def4d6e0e1d15d0862a7cac8810 100644 (file)
@@ -60,7 +60,7 @@ fixture_setup(TestFixture *fixture, gconstpointer data, gchar **envp)
 
     fixture->loop = g_main_loop_new(NULL, FALSE);
 
-    fixture->test_dir = g_strdup("/tmp/qgatest.XXXXXX");
+    fixture->test_dir = g_strdup_printf("%s/qgatest.XXXXXX", g_get_tmp_dir());
     g_assert_nonnull(g_mkdtemp(fixture->test_dir));
 
     path = g_build_filename(fixture->test_dir, "sock", NULL);