[gvfs] ftp: try copy and delete fallback if backup couldn't be created



commit 3e73fe863c5a5201f77fe8f6e0bec81cad22288d
Author: Ondrej Holy <oholy redhat com>
Date:   Thu Nov 13 13:30:43 2014 +0100

    ftp: try copy and delete fallback if backup couldn't be created
    
    Move operation fails immediately with G_IO_ERROR_CANT_CREATE_BACKUP if
    G_FILE_COPY_BACKUP is specified. Consequently copy and delete fallback
    isn't executed. Return NOT_SUPPORTED instead of CANT_CREATE_BACKUP to
    proceed with the fallback if G_FILE_COPY_NO_FALLBACK_FOR_MOVE isn't
    specified.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=740057

 daemon/gvfsbackendftp.c |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/daemon/gvfsbackendftp.c b/daemon/gvfsbackendftp.c
index fd940df..181b19f 100644
--- a/daemon/gvfsbackendftp.c
+++ b/daemon/gvfsbackendftp.c
@@ -1336,10 +1336,24 @@ do_move (GVfsBackend *backend,
   if (flags & G_FILE_COPY_BACKUP)
     {
       /* FIXME: implement? */
-      g_set_error_literal (&task.error,
-                           G_IO_ERROR,
-                           G_IO_ERROR_CANT_CREATE_BACKUP,
-                           _("backups not supported yet"));
+
+      if (flags & G_FILE_COPY_NO_FALLBACK_FOR_MOVE)
+        {
+          g_set_error_literal (&task.error,
+                               G_IO_ERROR,
+                               G_IO_ERROR_CANT_CREATE_BACKUP,
+                               _("Backups not supported"));
+        }
+      else
+        {
+          /* Return G_IO_ERROR_NOT_SUPPORTED instead of G_IO_ERROR_CANT_CREATE_BACKUP
+           * to be proceeded with copy and delete fallback (see g_file_move). */
+          g_set_error_literal (&task.error,
+                               G_IO_ERROR,
+                               G_IO_ERROR_NOT_SUPPORTED,
+                               "Operation not supported");
+        }
+
       g_vfs_ftp_task_done (&task);
       return;
     }


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