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

Marc-André Lureau marcandre.lureau at redhat.com
Thu Aug 28 13:19:04 PDT 2014


Make sure we send a xfer data message for 0-size files.
This avoid leaking file descriptiors in guest agent when
copying such files.

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



More information about the Spice-devel mailing list