From: Michael S. Tsirkin Date: Thu, 1 Oct 2015 12:50:52 +0000 (+0300) Subject: vhost-user-test: fix predictable filename on tmpfs X-Git-Tag: v2.5.0-rc0~90^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6fdac09370530be0cc6fe9e8d425c0670ba994b1;p=thirdparty%2Fqemu.git 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: Michael S. Tsirkin Reviewed-by: Marc-André Lureau --- diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 5e63cbc1123..56df5cc5526 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -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);