(DO_CHOWN): Don't fail for non-root when chown fails due
authorJim Meyering <jim@meyering.net>
Sun, 25 Jan 1998 09:28:48 +0000 (09:28 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 25 Jan 1998 09:28:48 +0000 (09:28 +0000)
not only to lack of permission (EPERM), but also to lack of support
(EINVAL).  Reported by Bengt Martensson.

src/copy.c

index a764d89..1a762df 100644 (file)
@@ -25,8 +25,9 @@
 #define DO_CHOWN(Chown, File, New_uid, New_gid)                                \
   (Chown ((File), (x->myeuid == 0 ? (New_uid) : x->myeuid), (New_gid)) \
    /* If non-root uses -p, it's ok if we can't preserve ownership.     \
-      But root probably wants to know, e.g. if NFS disallows it.  */   \
-   && (errno != EPERM || x->myeuid == 0))
+      But root probably wants to know, e.g. if NFS disallows it,       \
+      or if the target system doesn't support file ownership. */       \
+   && ((errno != EPERM && errno != EINVAL) || x->myeuid == 0))
 
 struct dir_list
 {