aboutsummaryrefslogtreecommitdiff
path: root/qemu-char.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-06-24 11:14:47 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-06-24 11:14:47 +0100
commit27acb9dd2407f41550e453b85aa5ebf1bd618b79 (patch)
tree0efbe99f94c1fee29e49418cf1f2e900fb3e7d70 /qemu-char.c
parent7ba48975d342ef4d9251097f24be0db328f36f7d (diff)
parentc4f5cdc53f181f6fe84a0f1bf99914598934a8a6 (diff)
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
pc,pci,vhost,net fixes, enhancements Don's patches to limit below-4g ram for pc Marcel's pcie hotplug rewrite Gabriel's changes to e1000 auto-negotiation qemu char bugfixes by Stefan misc bugfixes Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Mon 23 Jun 2014 16:25:19 BST using RSA key ID D28D5469 # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" * remotes/mst/tags/for_upstream: (23 commits) xen-hvm: Handle machine opt max-ram-below-4g pc & q35: Add new machine opt max-ram-below-4g xen-hvm: Fix xen_hvm_init() to adjust pc memory layout pcie: coding style tweak hw/pcie: better hotplug/hotunplug support hw/pcie: implement power controller functionality hw/pcie: correct debug message q35: Use PC_Q35_COMPAT_1_4 on pc-q35-1.4 compat_props virtio-pci: Report an error when msix vectors init fails qemu-char: avoid leaking unused fds in tcp_get_msgfds() qemu-char: fix qemu_chr_fe_get_msgfd() qapi/string-output-visitor: fix human output e1000: factor out checking for auto-negotiation availability e1000: move e1000_autoneg_timer() to after set_ics() e1000: signal guest on successful link auto-negotiation e1000: improve auto-negotiation reporting via mii-tool e1000: emulate auto-negotiation during external link status change qtest: fix vhost-user-test unbalanced mutex locks qtest: fix qtest for vhost-user libqemustub: add more stubs for qemu-char ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'qemu-char.c')
-rw-r--r--qemu-char.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/qemu-char.c b/qemu-char.c
index e4eb985b57..e6cbafb09c 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -204,7 +204,7 @@ void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len)
int qemu_chr_fe_get_msgfd(CharDriverState *s)
{
int fd;
- return (qemu_chr_fe_get_msgfds(s, &fd, 1) >= 0) ? fd : -1;
+ return (qemu_chr_fe_get_msgfds(s, &fd, 1) == 1) ? fd : -1;
}
int qemu_chr_fe_get_msgfds(CharDriverState *s, int *fds, int len)
@@ -2481,8 +2481,15 @@ static int tcp_get_msgfds(CharDriverState *chr, int *fds, int num)
int to_copy = (s->read_msgfds_num < num) ? s->read_msgfds_num : num;
if (to_copy) {
+ int i;
+
memcpy(fds, s->read_msgfds, to_copy * sizeof(int));
+ /* Close unused fds */
+ for (i = to_copy; i < s->read_msgfds_num; i++) {
+ close(s->read_msgfds[i]);
+ }
+
g_free(s->read_msgfds);
s->read_msgfds = 0;
s->read_msgfds_num = 0;