From 088ce4e83b2fd96214b83b3b9e9e535cf746e904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 28 Aug 2014 22:17:31 +0200 Subject: [PATCH] xfer: send data message of size 0 for 0-size file Make sure we send a xfer data message for 0-size files. This avoid leaking file descriptiors in guest agent when copying such files. Reported-by: Cody Chan 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 84e6142..f14708f 100644 --- a/gtk/channel-main.c +++ b/gtk/channel-main.c @@ -1735,9 +1735,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