From: Jim Meyering Date: Sun, 25 Jan 1998 09:27:57 +0000 (+0000) Subject: (re_protect): Don't fail for non-root when chown fails due X-Git-Tag: FILEUTILS-3_16l~13 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=7c04ce1f097dcbd487e3b80ff2c22f287fa1d0e7;p=thirdparty%2Fcoreutils.git (re_protect): Don't fail for non-root when chown fails due not only to lack of permission (EPERM), but also to lack of support (EINVAL). Reported by Bengt Martensson. --- diff --git a/src/cp.c b/src/cp.c index cc2e4ea7c0..1e64cf4bd3 100644 --- a/src/cp.c +++ b/src/cp.c @@ -247,9 +247,10 @@ re_protect (const char *const_dst_path, int src_offset, } /* 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. */ + But root probably wants to know, e.g. if NFS disallows it, + or if the target system doesn't support file ownership. */ if (chown (dst_path, src_sb.st_uid, src_sb.st_gid) - && (errno != EPERM || myeuid == 0)) + && ((errno != EPERM && errno != EINVAL) || myeuid == 0)) { error (0, errno, _("preserving ownership for %s"), dst_path); return 1;