Commit 6fdac093 authored by Michael S. Tsirkin's avatar Michael S. Tsirkin
Browse files

vhost-user-test: fix predictable filename on tmpfs



vhost-user-test uses getpid to create a unique filename. This name is
predictable, and a security problem.  Instead, use a tmp directory
created by mkdtemp, which is a suggested best practice.

Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
parent 1b7e1e3b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -330,7 +330,7 @@ int main(int argc, char **argv)
        root = tmpfs;
    }

    socket_path = g_strdup_printf("/tmp/vhost-%d.sock", getpid());
    socket_path = g_strdup_printf("%s/vhost.sock", tmpfs);

    /* create char dev and add read handlers */
    qemu_add_opts(&qemu_chardev_opts);