Fix bug 2999830: do not report failed chown() on copy.
[geeqie.git] / src / ui_fileops.c
index aa3cc8d..33c6560 100644 (file)
@@ -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;