[gvfs/wip/oholy/google-progress: 11/11] ftp: Prevent source file removal in case of transfer failure




commit 44f256758bbd7a898414779f3456ac9320428025
Author: Ondrej Holy <oholy redhat com>
Date:   Mon Oct 5 11:55:11 2020 +0200

    ftp: Prevent source file removal in case of transfer failure
    
    When moving file from FTP to local filesystem, the remote file is removed
    regradless of transfer failure. This is pretty bad as it might lead to data
    loss. Let's delete the remote file only if the transfer suceeded.

 daemon/gvfsbackendftp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/daemon/gvfsbackendftp.c b/daemon/gvfsbackendftp.c
index 1f2f23ad..16716e04 100644
--- a/daemon/gvfsbackendftp.c
+++ b/daemon/gvfsbackendftp.c
@@ -1706,7 +1706,7 @@ do_pull (GVfsBackend *         backend,
   g_vfs_ftp_task_receive (&task, 0, NULL);
   g_object_unref (output);
 
-  if (remove_source)
+  if (!g_vfs_ftp_task_is_in_error (&task) && remove_source)
     {
       g_vfs_ftp_task_send (&task,
                           G_VFS_FTP_PASS_500,


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