[virt-tools-list] [PATCH virt-manager] tunnels: do not close unowned fd

Giuseppe Scrivano gscrivan at redhat.com
Wed Nov 12 11:20:08 UTC 2014


Marc-André Lureau <marcandre.lureau at redhat.com> writes:

> The fd is handed to spice-gtk and gtk-vnc. They will close it when no
> longer needed. Double closing leads to various race issues, since the
> same fd may be opened for a different usage.
>
> Fixes:
> https://bugzilla.redhat.com/show_bug.cgi?id=1081227
> ---
>  virtManager/sshtunnels.py | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/virtManager/sshtunnels.py b/virtManager/sshtunnels.py
> index 8443694..2827295 100644
> --- a/virtManager/sshtunnels.py
> +++ b/virtManager/sshtunnels.py
> @@ -153,10 +153,7 @@ class _Tunnel(object):
>                        self.outfd and self.outfd.fileno() or self._outfds,
>                        self.errfd and self.errfd.fileno() or self._errfds)
>  
> -        if self.outfd:
> -            self.outfd.close()
> -        elif self._outfds:
> -            self._outfds[0].close()
> +        if self._outfds:
>              self._outfds[1].close()
>          self.outfd = None
>          self._outfds = None

Looks fine to me, but since Cole was following the discussion in the BZ,
I'll wait for his opinion before pushing it.

Regards,
Giuseppe




More information about the virt-tools-list mailing list