]> git.ipfire.org Git - thirdparty/libvirt.git/commit
API: Tweak virDomainOpenGraphics to return fd directly
authorEric Blake <eblake@redhat.com>
Tue, 26 Aug 2014 22:04:37 +0000 (16:04 -0600)
committerEric Blake <eblake@redhat.com>
Tue, 26 Aug 2014 22:36:32 +0000 (16:36 -0600)
commitb259e459b9d424fb9e176642e42c0a531fe3d7ee
treeb0b57cf0fb9f99c4f714172cb271082247eabddf
parent993fa528a633e5c695d06b9db26b2a938fb6cb21
API: Tweak virDomainOpenGraphics to return fd directly

Let's fix this before we bake in a painful API.  Since we know
that we have exactly one non-negative fd on success, we might
as well return the fd directly instead of forcing the user to
pass in a pointer.  Furthermore, I found some memory and fd
leaks while reviewing the code - the idea is that on success,
libvirtd will have handed two fds in two different directions:
one to qemu, and one to the RPC client.

* include/libvirt/libvirt.h.in (virDomainOpenGraphicsFD): Drop
unneeded parameter.
* src/driver.h (virDrvDomainOpenGraphicsFD): Likewise.
* src/libvirt.c (virDomainOpenGraphicsFD): Adjust interface to
return fd directly.
* daemon/remote.c (remoteDispatchDomainOpenGraphicsFd): Adjust
semantics.
* src/qemu/qemu_driver.c (qemuDomainOpenGraphicsFD): Likewise,
and plug fd leak.
* src/remote/remote_driver.c (remoteDomainOpenGraphicsFD):
Likewise, and plug memory and fd leak.

Signed-off-by: Eric Blake <eblake@redhat.com>
daemon/remote.c
include/libvirt/libvirt.h.in
src/driver.h
src/libvirt.c
src/qemu/qemu_driver.c
src/remote/remote_driver.c