tests/qtest: generic_fuzz: Avoid using hardcoded /tmp

This case was written to use hardcoded /tmp directory for temporary
files. Update to use g_dir_make_tmp() 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-11-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Bin Meng 2022-09-25 19:29:48 +08:00 committed by Thomas Huth
parent 394bcc5bc5
commit 9e5d84037f

View File

@ -20,8 +20,8 @@ typedef struct generic_fuzz_config {
} generic_fuzz_config;
static inline gchar *generic_fuzzer_virtio_9p_args(void){
char tmpdir[] = "/tmp/qemu-fuzz.XXXXXX";
g_assert_nonnull(g_mkdtemp(tmpdir));
g_autofree char *tmpdir = g_dir_make_tmp("qemu-fuzz.XXXXXX", NULL);
g_assert_nonnull(tmpdir);
return g_strdup_printf("-machine q35 -nodefaults "
"-device virtio-9p,fsdev=hshare,mount_tag=hshare "