[gvfs] ftp: Return the correct error code for a failed move operation



commit 7fae7088c21c4f5cdae2327915edd21b1ec4574f
Author: Ross Lagerwall <rosslagerwall gmail com>
Date:   Wed Oct 16 21:56:13 2013 +0200

    ftp: Return the correct error code for a failed move operation
    
    When the source file does not exist for a move operation, return
    G_IO_ERROR_NOT_FOUND (as specified by the docs) instead of
    G_IO_ERROR_FAILED.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=710321

 daemon/gvfsbackendftp.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/daemon/gvfsbackendftp.c b/daemon/gvfsbackendftp.c
index 8edb448..80a2f9a 100644
--- a/daemon/gvfsbackendftp.c
+++ b/daemon/gvfsbackendftp.c
@@ -1323,6 +1323,8 @@ do_move (GVfsBackend *backend,
   GVfsBackendFtp *ftp = G_VFS_BACKEND_FTP (backend);
   GVfsFtpTask task = G_VFS_FTP_TASK_INIT (ftp, G_VFS_JOB (job));
   GVfsFtpFile *srcfile, *destfile;
+  static const GVfsFtpErrorFunc rnfr_handlers[] = { error_550_permission_or_not_found,
+                                                    NULL };
 
   /* FIXME: what about G_FILE_COPY_NOFOLLOW_SYMLINKS and G_FILE_COPY_ALL_METADATA? */
 
@@ -1374,9 +1376,15 @@ do_move (GVfsBackend *backend,
         }
     }
 
-  g_vfs_ftp_task_send (&task,
-                       G_VFS_FTP_PASS_300 | G_VFS_FTP_FAIL_200,
-                       "RNFR %s", g_vfs_ftp_file_get_ftp_path (srcfile));
+
+  if (!g_vfs_ftp_task_send_and_check (&task,
+                                 G_VFS_FTP_PASS_300 | G_VFS_FTP_FAIL_200,
+                                 rnfr_handlers,
+                                 srcfile,
+                                 NULL,
+                                 "RNFR %s", g_vfs_ftp_file_get_ftp_path (srcfile)))
+    goto out;
+
   g_vfs_ftp_task_send (&task,
                        0,
                        "RNTO %s", g_vfs_ftp_file_get_ftp_path (destfile));


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