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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]