* [PATCH] char: do not double-close fd when failing to add client
@ 2023-02-07 9:35 marcandre.lureau
2023-02-07 9:39 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 2+ messages in thread
From: marcandre.lureau @ 2023-02-07 9:35 UTC (permalink / raw)
To: qemu-devel; +Cc: armbru, Marc-André Lureau, Paolo Bonzini
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>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] char: do not double-close fd when failing to add client
2023-02-07 9:35 [PATCH] char: do not double-close fd when failing to add client marcandre.lureau
@ 2023-02-07 9:39 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-07 9:39 UTC (permalink / raw)
To: marcandre.lureau, qemu-devel; +Cc: armbru, Paolo Bonzini
On 7/2/23 10:35, marcandre.lureau@redhat.com wrote:
> 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>
> ---
> chardev/char.c | 2 --
> 1 file changed, 2 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-02-07 9:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-07 9:35 [PATCH] char: do not double-close fd when failing to add client marcandre.lureau
2023-02-07 9:39 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).