aboutsummaryrefslogtreecommitdiff
path: root/qapi
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2023-03-06 16:27:45 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2023-03-13 15:40:41 +0400
commitbf5de8c5d66552721fefe08de849c115ca366b56 (patch)
treeb03ab6660003d38914e76f39d660fe80d8e29c90 /qapi
parent0a237f4de45b8addbc35a316ee1c0bc7a4887da7 (diff)
downloadqemu-bf5de8c5d66552721fefe08de849c115ca366b56.zip
qemu-bf5de8c5d66552721fefe08de849c115ca366b56.tar.gz
qemu-bf5de8c5d66552721fefe08de849c115ca366b56.tar.bz2
qmp: 'add_client' actually expects sockets
Whether it is SPICE, VNC, D-Bus, or the socket chardev, they all actually expect a socket kind or will fail in different ways at runtime. Throw an error early if the given 'add_client' fd is not a socket, and close it to avoid leaks. This allows to replace the close() call with a more correct & portable closesocket() version. (this will allow importing sockets on Windows with a specialized command in the following patch, while keeping the remaining monitor associated sockets/add_client code & usage untouched) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Acked-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20230306122751.2355515-6-marcandre.lureau@redhat.com>
Diffstat (limited to 'qapi')
-rw-r--r--qapi/misc.json3
1 files changed, 3 insertions, 0 deletions
diff --git a/qapi/misc.json b/qapi/misc.json
index 27ef5a2..f0217cf 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -14,6 +14,9 @@
# Allow client connections for VNC, Spice and socket based
# character devices to be passed in to QEMU via SCM_RIGHTS.
#
+# If the FD associated with @fdname is not a socket, the command will fail and
+# the FD will be closed.
+#
# @protocol: protocol name. Valid names are "vnc", "spice", "@dbus-display" or
# the name of a character device (eg. from -chardev id=XXXX)
#