[Spice-devel] [linux-vdagent PATCH 08/10] file-xfers: Fix unlinking of files on error / cancel

Hans de Goede hdegoede at redhat.com
Wed Mar 6 07:22:44 PST 2013


Store the complete path, rather then just the basename in task->file_name,
so that unlinking on error actually works.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 src/vdagent-file-xfers.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/vdagent-file-xfers.c b/src/vdagent-file-xfers.c
index 959a491..2f0f3d3 100644
--- a/src/vdagent-file-xfers.c
+++ b/src/vdagent-file-xfers.c
@@ -189,9 +189,11 @@ void vdagent_file_xfers_start(struct vdagent_file_xfers *xfers,
         g_free(path);
         path = g_strdup_printf("%s (%d)", file_path, i + 1);
     }
+    g_free(task->file_name);
+    task->file_name = path;
     if (i == 64) {
         syslog(LOG_ERR, "file-xfer: more then 63 copies of %s exist?",
-               task->file_name);
+               file_path);
         goto error;
     }
 
@@ -217,7 +219,6 @@ void vdagent_file_xfers_start(struct vdagent_file_xfers *xfers,
     udscs_write(xfers->vdagentd, VDAGENTD_FILE_XFER_STATUS,
                 msg->id, VD_AGENT_FILE_XFER_STATUS_CAN_SEND_DATA, NULL, 0);
     g_free(file_path);
-    g_free(path);
     g_free(dir);
     return ;
 
@@ -227,7 +228,6 @@ error:
     if (task)
         vdagent_file_xfer_task_free(task);
     g_free(file_path);
-    g_free(path);
     g_free(dir);
 }
 
-- 
1.8.1.4



More information about the Spice-devel mailing list