changeset 1870:0edb60ebe74b

Fix bug 2999830: do not report failed chown() on copy. Debian bug 574853 reported by Ian Zimmerman <itz@buug.org> I was trying to copy images from my camera which is mounted as a USB mass storage device. The files on the mount are owned by root, and geeqie tries to chown (and chgrp) the copy, fails, and displays an error message. This is only mildly annoying when copying a single file, but when I want to copy multiple files the failure stops the operation after the first file. Patch by Vladislav Naumov <vnaum@vnaum.com> This patch ignores chown errors, while still doing chown (so root still can copy files preserving ownership). http://sourceforge.net/tracker/?func=detail&aid=2999830&group_id=222125&atid=1054680 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=574853 (original report)
author Vladislav Naumov <vnaum@vnaum.com>
date Thu, 16 Dec 2010 21:55:03 +0100
parents 12df95a27df1
children a8cdf1b5af6f
files src/ui_fileops.c
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ui_fileops.c	Sun Jul 24 13:17:34 2011 +0100
+++ b/src/ui_fileops.c	Thu Dec 16 21:55:03 2010 +0100
@@ -490,8 +490,14 @@
 
 		/* set the dest file attributes to that of source (ignoring errors) */
 
-		if (perms && chown(tl, st.st_uid, st.st_gid) < 0) ret = FALSE;
-		if (perms && chmod(tl, st.st_mode) < 0) ret = FALSE;
+		if (perms)
+			{
+			ret = chown(tl, st.st_uid, st.st_gid);
+			/* Ignores chown errors, while still doing chown
+			   (so root still can copy files preserving ownership) */
+			ret = TRUE;
+			if (chmod(tl, st.st_mode) < 0) ret = FALSE;
+			}
 
 		tb.actime = st.st_atime;
 		tb.modtime = st.st_mtime;