summaryrefslogtreecommitdiff
path: root/src/cp.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-01-25 09:27:57 +0000
committerJim Meyering <jim@meyering.net>1998-01-25 09:27:57 +0000
commit7c04ce1f097dcbd487e3b80ff2c22f287fa1d0e7 (patch)
tree93c06dbc840dbac564b84e5c6ba74a460093d85a /src/cp.c
parent7b4833b03c53c975a21596d911a3b8ec4cc20e34 (diff)
downloadcoreutils-7c04ce1f097dcbd487e3b80ff2c22f287fa1d0e7.tar.xz
(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.
Diffstat (limited to 'src/cp.c')
-rw-r--r--src/cp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cp.c b/src/cp.c
index cc2e4ea7c..1e64cf4bd 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;