From dc8933e3c0ae3e0021d13beb666d6729267c7624 Mon Sep 17 00:00:00 2001 From: Vladislav Naumov Date: Thu, 16 Dec 2010 21:55:03 +0100 Subject: [PATCH] Fix bug 2999830: do not report failed chown() on copy. Debian bug 574853 reported by Ian Zimmerman 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 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) --- src/ui_fileops.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ui_fileops.c b/src/ui_fileops.c index aa3cc8d..33c6560 100644 --- a/src/ui_fileops.c +++ b/src/ui_fileops.c @@ -490,8 +490,14 @@ gboolean copy_file_attributes(const gchar *s, const gchar *t, gint perms, gint m /* 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; -- 1.6.1