summary refs log tree commit diff stats
path: root/util/qemu-sockets.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-11-02 10:44:21 +0100
committerDaniel P. Berrangé <berrange@redhat.com>2020-11-03 13:17:12 +0000
commitef298e3826e574c712d10e38a5f2a3629d6f5e01 (patch)
tree181faeb522cbcbc6fedc7b534c0133114e85e723 /util/qemu-sockets.c
parentdea7cd1794f33c52e4b59fe085daffb318a4bb07 (diff)
downloadfocaccia-qemu-ef298e3826e574c712d10e38a5f2a3629d6f5e01.tar.gz
focaccia-qemu-ef298e3826e574c712d10e38a5f2a3629d6f5e01.zip
sockets: Bypass "replace empty @path" for abstract unix sockets
unix_listen_saddr() replaces empty @path by unique value.  It obtains
the value by creating and deleting a unique temporary file with
mkstemp().  This is racy, as the comment explains.  It's also entirely
undocumented as far as I can tell.  Goes back to commit d247d25f18
"sockets: helper functions for qemu (Gerd Hoffman)", v0.10.0.

Since abstract socket addresses have no connection with filesystem
pathnames, making them up with mkstemp() seems inappropriate.  Bypass
the replacement of empty @path.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'util/qemu-sockets.c')
-rw-r--r--util/qemu-sockets.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index a578c434c2..671717499f 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -877,7 +877,7 @@ static int unix_listen_saddr(UnixSocketAddress *saddr,
         return -1;
     }
 
-    if (saddr->path && saddr->path[0]) {
+    if (saddr->path[0] || saddr->abstract) {
         path = saddr->path;
     } else {
         const char *tmpdir = getenv("TMPDIR");