summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2014-11-13 13:30:43 +0100
committerOndrej Holy <oholy@redhat.com>2014-11-19 08:54:41 +0100
commit3e73fe863c5a5201f77fe8f6e0bec81cad22288d (patch)
tree9026adbb2dd782a7706c3012d553245c50acddaa
parenta336ef412ace2f9fc169185c48bca657e28c646e (diff)
downloadgvfs-3e73fe863c5a5201f77fe8f6e0bec81cad22288d.tar.gz
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
-rw-r--r--daemon/gvfsbackendftp.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/daemon/gvfsbackendftp.c b/daemon/gvfsbackendftp.c
index fd940df7..181b19fd 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;
}