[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 02/10] char: do not double-close fd when failing to add client
From: |
marcandre . lureau |
Subject: |
[PATCH v3 02/10] char: do not double-close fd when failing to add client |
Date: |
Tue, 7 Feb 2023 18:25: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>
---
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.1
- [PATCH v3 00/10] Teach 'getfd' QMP command to import win32 sockets, marcandre . lureau, 2023/02/07
- [PATCH v3 01/10] tests: fix path separator, use g_build_filename(), marcandre . lureau, 2023/02/07
- [PATCH v3 02/10] char: do not double-close fd when failing to add client,
marcandre . lureau <=
- [PATCH v3 03/10] tests/docker: fix a win32 error due to portability, marcandre . lureau, 2023/02/07
- [PATCH v3 04/10] osdep: implement qemu_socketpair() for win32, marcandre . lureau, 2023/02/07
- [PATCH v3 05/10] qmp: 'add_client' actually expects sockets, marcandre . lureau, 2023/02/07
- [PATCH v3 06/10] monitor: release the lock before calling close(), marcandre . lureau, 2023/02/07