summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorBin Meng2022-09-27 13:05:42 +0200
committerDaniel P. Berrangé2022-10-26 14:32:08 +0200
commit926a895c2cfcd621373eb86288dd83d08cb53f15 (patch)
tree37dc5125db79b1ed0b61cd7aa1c97298a9742aa1 /util
parentcrypto/luks: Support creating LUKS image on Darwin (diff)
downloadqemu-926a895c2cfcd621373eb86288dd83d08cb53f15.tar.gz
qemu-926a895c2cfcd621373eb86288dd83d08cb53f15.tar.xz
qemu-926a895c2cfcd621373eb86288dd83d08cb53f15.zip
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>
Diffstat (limited to 'util')
-rw-r--r--util/qemu-sockets.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index 83f4bd6fd2..0c41ca9e42 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -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);