diff mbox series

[v4,04/54] util/qemu-sockets: Use g_get_tmp_dir() to get the directory for temporary files

Message ID 20220927110632.1973965-5-bmeng.cn@gmail.com
State New
Headers show
Series tests/qtest: Enable running qtest on Windows | expand

Commit Message

Bin Meng Sept. 27, 2022, 11:05 a.m. UTC
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>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---

(no changes since v1)

 util/qemu-sockets.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Bin Meng Oct. 1, 2022, 3:44 a.m. UTC | #1
Hi Daniel,

On Tue, Sep 27, 2022 at 7:06 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> 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>
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>
> (no changes since v1)
>
>  util/qemu-sockets.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>

Would you pick up this patch in your queue?

Regards,
Bin
Daniel P. Berrangé Oct. 3, 2022, 10:28 a.m. UTC | #2
On Sat, Oct 01, 2022 at 11:44:09AM +0800, Bin Meng wrote:
> Hi Daniel,
> 
> On Tue, Sep 27, 2022 at 7:06 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > 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>
> > Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >
> > (no changes since v1)
> >
> >  util/qemu-sockets.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> >
> 
> Would you pick up this patch in your queue?

Yes, added to me queue.

With regards,
Daniel
diff mbox series

Patch

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);