Skip to content

Commit

Permalink
util/qemu-sockets: Use g_get_tmp_dir() to get the directory for tempo…
Browse files Browse the repository at this point in the history
…rary 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>
  • Loading branch information
lbmeng authored and berrange committed Oct 26, 2022
1 parent bf98afc commit 926a895
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions util/qemu-sockets.c
Expand Up @@ -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);
Expand Down

0 comments on commit 926a895

Please sign in to comment.