]> git.proxmox.com Git - mirror_qemu.git/commitdiff
char: do not double-close fd when failing to add client
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Mon, 6 Mar 2023 12:27:42 +0000 (16:27 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Mon, 13 Mar 2023 11:39:31 +0000 (15:39 +0400)
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

index 11eab7764c6de3680cb0f7ad966941be892beeca..e69390601fc25a7898cada95bca6f112c0ff3fbc 100644 (file)
@@ -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;