[virt-tools-list] [virt-viewer PATCH] Prefer virDomainOpenGraphicsFD for --attach
Fabiano Fidêncio
fabiano at fidencio.org
Mon Sep 29 22:01:57 UTC 2014
ACK!
On Fri, Sep 12, 2014 at 3:03 PM, Ján Tomko <jtomko at redhat.com> wrote:
> The virDomainOpenGraphics API cannot label the socket
> we pass to it. Prefer virDomainOpenGraphicsFD (introduced
> in libvirt 1.2.8) which creates the socket for us
> and works with SELinux too.
>
> Signed-off-by: Ján Tomko <jtomko at redhat.com>
> ---
> src/virt-viewer.c | 19 ++++---------------
> 1 file changed, 4 insertions(+), 15 deletions(-)
>
> diff --git a/src/virt-viewer.c b/src/virt-viewer.c
> index f8a9ab5..67e6055 100644
> --- a/src/virt-viewer.c
> +++ b/src/virt-viewer.c
> @@ -423,30 +423,19 @@ virt_viewer_update_display(VirtViewer *self,
> virDomainPtr dom)
> static gboolean
> virt_viewer_open_connection(VirtViewerApp *self G_GNUC_UNUSED, int *fd)
> {
> -#if defined(HAVE_SOCKETPAIR)
> VirtViewer *viewer = VIRT_VIEWER(self);
> VirtViewerPrivate *priv = viewer->priv;
> - int pair[2];
> -#endif
> +
> *fd = -1;
> -#if defined(HAVE_SOCKETPAIR)
> +
> if (!priv->dom)
> return TRUE;
>
> - if (socketpair(PF_UNIX, SOCK_STREAM, 0, pair) < 0)
> - return FALSE;
> -
> - if (virDomainOpenGraphics(priv->dom, 0, pair[0],
> - VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH) < 0) {
> + if ((*fd = virDomainOpenGraphicsFD(priv->dom, 0,
> +
> VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH)) < 0) {
> virErrorPtr err = virGetLastError();
> g_debug("Error %s", err && err->message ? err->message :
> "Unknown");
> - close(pair[0]);
> - close(pair[1]);
> - return TRUE;
> }
> - close(pair[0]);
> - *fd = pair[1];
> -#endif
> return TRUE;
> }
>
> --
> 1.8.5.5
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
--
Fabiano Fidêncio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20140930/a165f58f/attachment.htm>
More information about the virt-tools-list
mailing list