util/qemu-sockets: Use g_get_tmp_dir() to get the directory for temporary files

Replace the existing logic to get the directory for temporary files
with g_get_tmp_dir(), which works for win32 too.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Bin Meng 2022-09-27 19:05:42 +08:00 committed by Daniel P. Berrangé
parent bf98afc75e
commit 926a895c2c

View File

@ -919,9 +919,8 @@ static int unix_listen_saddr(UnixSocketAddress *saddr,
if (saddr->path[0] || abstract) {
path = saddr->path;
} else {
const char *tmpdir = getenv("TMPDIR");
tmpdir = tmpdir ? tmpdir : "/tmp";
path = pathbuf = g_strdup_printf("%s/qemu-socket-XXXXXX", tmpdir);
path = pathbuf = g_strdup_printf("%s/qemu-socket-XXXXXX",
g_get_tmp_dir());
}
pathlen = strlen(path);