[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/51] util/qemu-sockets: Use g_get_tmp_dir() to get the director
From: |
Bin Meng |
Subject: |
[PATCH 06/51] util/qemu-sockets: Use g_get_tmp_dir() to get the directory for temporary files |
Date: |
Wed, 24 Aug 2022 17:39:44 +0800 |
From: Bin Meng <bin.meng@windriver.com>
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>
---
util/qemu-sockets.c | 5 ++---
1 file 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);
--
2.34.1
- Re: [PATCH 01/51] tests/qtest: Use g_setenv(), (continued)
- [PATCH 02/51] tests/qtest: Use g_mkdtemp(), Bin Meng, 2022/08/24
- [PATCH 03/51] block: Unify the get_tmp_filename() implementation, Bin Meng, 2022/08/24
- [PATCH 04/51] semihosting/arm-compat-semi: Avoid using hardcoded /tmp, Bin Meng, 2022/08/24
- [PATCH 05/51] tcg: Avoid using hardcoded /tmp, Bin Meng, 2022/08/24
- [PATCH 06/51] util/qemu-sockets: Use g_get_tmp_dir() to get the directory for temporary files,
Bin Meng <=
- [PATCH 09/51] fsdev/virtfs-proxy-helper: Use g_mkdir_with_parents(), Bin Meng, 2022/08/24
[PATCH 07/51] tests: Avoid using hardcoded /tmp in test cases, Bin Meng, 2022/08/24