summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2009-02-16 11:26:12 +0000
committerAlexander Larsson <alexl@src.gnome.org>2009-02-16 11:26:12 +0000
commit7178c101038bec7391070ab3a231f4c1cd7edbb8 (patch)
treeebb639e6dfead8ebbe04d22a68de6e6e0b2a2652
parent6543cd5ebf6d8532fe52cbb2a8a51cc882b170ce (diff)
downloadgvfs-7178c101038bec7391070ab3a231f4c1cd7edbb8.tar.gz
Return G_IO_ERROR_CANT_CREATE_BACKUP in the below case instead of not
2009-02-16 Alexander Larsson <alexl@redhat.com> * daemon/gvfsbackendsftp.c (replace_create_temp_reply): Return G_IO_ERROR_CANT_CREATE_BACKUP in the below case instead of not copying the ownership. svn path=/trunk/; revision=2224
-rw-r--r--ChangeLog6
-rw-r--r--daemon/gvfsbackendsftp.c20
2 files changed, 20 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 3a3966bf..cb468c6d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2009-02-16 Alexander Larsson <alexl@redhat.com>
+ * daemon/gvfsbackendsftp.c (replace_create_temp_reply):
+ Return G_IO_ERROR_CANT_CREATE_BACKUP in the below case instead
+ of not copying the ownership.
+
+2009-02-16 Alexander Larsson <alexl@redhat.com>
+
Bug 546482 – Keep ownership when replacing files on sftp
* daemon/gvfsbackendsftp.c:
diff --git a/daemon/gvfsbackendsftp.c b/daemon/gvfsbackendsftp.c
index 2bbb4ee0..d59c1418 100644
--- a/daemon/gvfsbackendsftp.c
+++ b/daemon/gvfsbackendsftp.c
@@ -2781,18 +2781,26 @@ replace_create_temp_reply (GVfsBackendSftp *backend,
replace_create_temp (backend, op_job);
}
else if (data->set_ownership &&
- error->code == G_IO_ERROR_PERMISSION_DENIED &&
- !op_job->make_backup)
+ error->code == G_IO_ERROR_PERMISSION_DENIED)
{
+ g_error_free (error);
+
/* This was probably due to the fact that the ownership could not be
set properly. In this case we change our strategy altogether and
simply open/truncate the original file. This is not as secure
as the atomit tempfile/move approach, but at least ownership
doesn't change */
- /* We only do this if make_backup is FALSE, as this version breaks
- the backup code. Would like to handle the backup case too by
- backing up before truncating... */
- replace_truncate_original (backend, job);
+ if (!op_job->make_backup)
+ replace_truncate_original (backend, job);
+ else
+ {
+ /* We only do this if make_backup is FALSE, as this version breaks
+ the backup code. Would like to handle the backup case too by
+ backing up before truncating, but for now error out... */
+ g_vfs_job_failed (job, G_IO_ERROR,
+ G_IO_ERROR_CANT_CREATE_BACKUP,
+ _("backups not supported yet"));
+ }
}
else
{