]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
tests/qtest: vhost-user-blk-test: Avoid using hardcoded /tmp
authorBin Meng <bin.meng@windriver.com>
Sun, 25 Sep 2022 11:29:55 +0000 (19:29 +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-18-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
tests/qtest/vhost-user-blk-test.c

index a81c2a2715d03ef047d2e115dd1cad51bbd11c8f..07a4c2d5001e48f463e875284e34972db395c78a 100644 (file)
@@ -841,7 +841,8 @@ static char *create_listen_socket(int *fd)
     char *path;
 
     /* No race because our pid makes the path unique */
-    path = g_strdup_printf("/tmp/qtest-%d-sock.XXXXXX", getpid());
+    path = g_strdup_printf("%s/qtest-%d-sock.XXXXXX",
+                           g_get_tmp_dir(), getpid());
     tmp_fd = mkstemp(path);
     g_assert_cmpint(tmp_fd, >=, 0);
     close(tmp_fd);