From acb270983155cfaf33190b5148909edb02c19dd1 Mon Sep 17 00:00:00 2001
From: Benedikt Meurer <benny@xfce.org>
Date: Thu, 16 Mar 2006 01:13:44 +0000
Subject: [PATCH] 2006-03-16	Benedikt Meurer <benny@xfce.org>

	* thunar-vfs/thunar-vfs-xfer.c: Also chmod u+rw the target file if we
	  are not the owner of the source file.
	* thunar-vfs/thunar-vfs-path.c(thunar_vfs_path_to_uri): Double checking
	  bufsize doesn't make much sense.




(Old svn revision: 20452)
---
 ChangeLog                    |  7 +++++++
 thunar-vfs/thunar-vfs-path.c |  1 -
 thunar-vfs/thunar-vfs-xfer.c | 12 ++++++------
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f5218d29e..db555d066 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-03-16	Benedikt Meurer <benny@xfce.org>
+
+	* thunar-vfs/thunar-vfs-xfer.c: Also chmod u+rw the target file if we
+	  are not the owner of the source file.
+	* thunar-vfs/thunar-vfs-path.c(thunar_vfs_path_to_uri): Double checking
+	  bufsize doesn't make much sense.
+
 2006-03-16	Benedikt Meurer <benny@xfce.org>
 
 	* thunar/thunar-window.c: Add backspace as shortcut for "Back".
diff --git a/thunar-vfs/thunar-vfs-path.c b/thunar-vfs/thunar-vfs-path.c
index af6ded5d7..b00cb53c2 100644
--- a/thunar-vfs/thunar-vfs-path.c
+++ b/thunar-vfs/thunar-vfs-path.c
@@ -777,7 +777,6 @@ thunar_vfs_path_to_uri (const ThunarVfsPath *path,
 
   g_return_val_if_fail (path != NULL, -1);
   g_return_val_if_fail (buffer != NULL, -1);
-  g_return_val_if_fail (bufsize > 0, -1);
   g_return_val_if_fail (error == NULL || *error == NULL, -1);
 
   /* verify that the buffer is large enough */
diff --git a/thunar-vfs/thunar-vfs-xfer.c b/thunar-vfs/thunar-vfs-xfer.c
index e6268d0cb..e67208735 100644
--- a/thunar-vfs/thunar-vfs-xfer.c
+++ b/thunar-vfs/thunar-vfs-xfer.c
@@ -283,10 +283,10 @@ thunar_vfs_xfer_copy_directory (const gchar          *source_absolute_path,
   /* default to the source dir permissions */
   mode = (source_statb->st_mode & ~S_IFMT);
 
-  /* if the source is located on a rdonly medium, we
-   * automatically chmod +rw the destination file.
+  /* if the source is located on a rdonly medium or we are not the owner of
+   * the source directory, we automatically chmod +rw the destination file.
    */
-  if (tvxc_mounted_readonly (source_absolute_path))
+  if (tvxc_mounted_readonly (source_absolute_path) || source_statb->st_uid != getuid ())
     mode |= (THUNAR_VFS_FILE_MODE_USR_READ | THUNAR_VFS_FILE_MODE_USR_WRITE);
 
   /* check if the directory exists */
@@ -367,10 +367,10 @@ thunar_vfs_xfer_copy_regular (const gchar          *source_absolute_path,
   /* default to the permissions of the source file */
   mode = source_statb->st_mode;
 
-  /* if the source is located on a rdonly medium, we
-   * automatically chmod +rw the destination file.
+  /* if the source is located on a rdonly medium or we are not the owner
+   * of the source file, we automatically chmod +rw the destination file.
    */
-  if (tvxc_mounted_readonly (source_absolute_path))
+  if (tvxc_mounted_readonly (source_absolute_path) || source_statb->st_uid != getuid ())
     mode |= (THUNAR_VFS_FILE_MODE_USR_READ | THUNAR_VFS_FILE_MODE_USR_WRITE);
 
   /* try to open the target file for writing */
-- 
GitLab