]> git.proxmox.com Git - mirror_qemu.git/commitdiff
tests: vhost-user-bridge: Avoid using hardcoded /tmp
authorBin Meng <bin.meng@windriver.com>
Sun, 25 Sep 2022 11:30:02 +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_file_open_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-25-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
tests/vhost-user-bridge.c

index 9b1dab2f288381fa6c90c31beb058913aecb5315..fecdf915e762065e17615c4ac5e8d0dfbf682f16 100644 (file)
@@ -631,7 +631,6 @@ static void *notifier_thread(void *arg)
 static void
 vubr_host_notifier_setup(VubrDev *dev)
 {
-    char template[] = "/tmp/vubr-XXXXXX";
     pthread_t thread;
     size_t length;
     void *addr;
@@ -639,7 +638,7 @@ vubr_host_notifier_setup(VubrDev *dev)
 
     length = qemu_real_host_page_size() * VHOST_USER_BRIDGE_MAX_QUEUES;
 
-    fd = mkstemp(template);
+    fd = g_file_open_tmp("vubr-XXXXXX", NULL, NULL);
     if (fd < 0) {
         vubr_die("mkstemp()");
     }