[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/25] char: do not double-close fd when failing to add client
From: |
marcandre . lureau |
Subject: |
[PULL 17/25] char: do not double-close fd when failing to add client |
Date: |
Mon, 13 Mar 2023 15:43:27 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
The caller is already closing the fd on failure.
Fixes: c3054a6e6a ("char: Factor out qmp_add_client() parts and move to
chardev/")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20230306122751.2355515-3-marcandre.lureau@redhat.com>
---
chardev/char.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/chardev/char.c b/chardev/char.c
index 11eab7764c..e69390601f 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -1175,12 +1175,10 @@ bool qmp_add_client_char(int fd, bool has_skipauth,
bool skipauth,
if (!s) {
error_setg(errp, "protocol '%s' is invalid", protocol);
- close(fd);
return false;
}
if (qemu_chr_add_client(s, fd) < 0) {
error_setg(errp, "failed to add client");
- close(fd);
return false;
}
return true;
--
2.39.2
- [PULL 07/25] win32/socket: introduce qemu_socket_unselect() helper, (continued)
- [PULL 07/25] win32/socket: introduce qemu_socket_unselect() helper, marcandre . lureau, 2023/03/13
- [PULL 10/25] main-loop: remove qemu_fd_register(), win32/slirp/socket specific, marcandre . lureau, 2023/03/13
- [PULL 08/25] aio: make aio_set_fd_poll() static to aio-posix.c, marcandre . lureau, 2023/03/13
- [PULL 09/25] aio/win32: aio_set_fd_handler() only supports SOCKET, marcandre . lureau, 2023/03/13
- [PULL 11/25] slirp: unregister the win32 SOCKET, marcandre . lureau, 2023/03/13
- [PULL 12/25] slirp: open-code qemu_socket_(un)select(), marcandre . lureau, 2023/03/13
- [PULL 14/25] os-posix: remove useless ioctlsocket() define, marcandre . lureau, 2023/03/13
- [PULL 13/25] win32: avoid mixing SOCKET and file descriptor space, marcandre . lureau, 2023/03/13
- [PULL 15/25] win32: replace closesocket() with close() wrapper, marcandre . lureau, 2023/03/13
- [PULL 16/25] tests: fix path separator, use g_build_filename(), marcandre . lureau, 2023/03/13
- [PULL 17/25] char: do not double-close fd when failing to add client,
marcandre . lureau <=
- [PULL 18/25] tests/docker: fix a win32 error due to portability, marcandre . lureau, 2023/03/13
- [PULL 19/25] osdep: implement qemu_socketpair() for win32, marcandre . lureau, 2023/03/13
- [PULL 20/25] qmp: 'add_client' actually expects sockets, marcandre . lureau, 2023/03/13
- [PULL 21/25] monitor: release the lock before calling close(), marcandre . lureau, 2023/03/13
- [PULL 22/25] qmp: add 'get-win32-socket', marcandre . lureau, 2023/03/13
- [PULL 23/25] libqtest: make qtest_qmp_add_client work on win32, marcandre . lureau, 2023/03/13
- [PULL 25/25] QMP/HMP: only actually implement getfd on CONFIG_POSIX, marcandre . lureau, 2023/03/13
- [PULL 24/25] qtest: enable vnc-display test on win32, marcandre . lureau, 2023/03/13
- Re: [PULL 00/25] Win socket patches, Marc-André Lureau, 2023/03/13
- Re: [PULL 00/25] Win socket patches, Marc-André Lureau, 2023/03/13