[Spice-devel] [PATCH spice-gtk] xfer: send data message of size 0 for 0-size file

Jonathon Jongsma jjongsma at redhat.com
Fri Aug 29 08:07:00 PDT 2014


On Fri, 2014-08-29 at 09:55 +0200, Christophe Fergeau wrote:
> Hey,
> 
> On Thu, Aug 28, 2014 at 10:19:04PM +0200, Marc-André Lureau wrote:
> > Make sure we send a xfer data message for 0-size files.
> > This avoid leaking file descriptiors in guest agent when
> > copying such files.
> 
> Has this been tested or should I give it a try? ACK if this has been
> tested. You could add a note that the bug was reported by Cody maybe

Is there any way for the agent to avoid leaking file descriptors even in
the face of a poorly-behaving client?


> 
> > 
> > https://bugzilla.redhat.com/show_bug.cgi?id=1135099
> > ---
> >  gtk/channel-main.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/gtk/channel-main.c b/gtk/channel-main.c
> > index f33b0fd..46c81c1 100644
> > --- a/gtk/channel-main.c
> > +++ b/gtk/channel-main.c
> > @@ -1637,9 +1637,11 @@ static void file_xfer_read_cb(GObject *source_object,
> >          return;
> >      }
> >  
> > -    if (count > 0) {
> > +    if (count > 0 || task->file_size == 0) {
> >          task->read_bytes += count;
> >          file_xfer_queue(task, count);
> > +        if (count == 0)
> > +            return;
> >          file_xfer_flush_async(channel, task->cancellable,
> >                                file_xfer_data_flushed_cb, task);
> >          task->pending = TRUE;
> > -- 
> > 1.9.3
> > 
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/spice-devel
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel




More information about the Spice-devel mailing list