From: Bin Meng Date: Sun, 25 Sep 2022 11:30:01 +0000 (+0800) Subject: tests/unit: test-qga: Avoid using hardcoded /tmp X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=5b9f2781c251aa0b98cf9a3b025b803a7e23e638;p=qemu.git tests/unit: test-qga: Avoid using hardcoded /tmp 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 Reviewed-by: Marc-André Lureau Message-Id: <20220925113032.1949844-24-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- diff --git a/tests/unit/test-qga.c b/tests/unit/test-qga.c index b6ea7c7304..b4e0a14573 100644 --- a/tests/unit/test-qga.c +++ b/tests/unit/test-qga.c @@ -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);