aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-05-31 17:33:23 -0500
committerRob Landley <rob@landley.net>2016-05-31 17:33:23 -0500
commit4cf8a72f550e6299138e336ab9f0d37c6b197dd4 (patch)
treef65e02bcda0c952c4e44b75ac7b376e67e10f245
parent6ba719100115ec788bcbc4276a1b4c31e937e855 (diff)
downloadtoybox-4cf8a72f550e6299138e336ab9f0d37c6b197dd4.tar.gz
In cp -a, don't complain if non-root user can't chown, failure is expected.0.7.1
-rw-r--r--toys/posix/cp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/posix/cp.c b/toys/posix/cp.c
index d21af2ff..06c537eb 100644
--- a/toys/posix/cp.c
+++ b/toys/posix/cp.c
@@ -318,7 +318,7 @@ int cp_node(struct dirtree *try)
rc = fchownat(cfd, catch, try->st.st_uid, try->st.st_gid,
AT_SYMLINK_NOFOLLOW);
else rc = fchown(fdout, try->st.st_uid, try->st.st_gid);
- if (rc) {
+ if (rc && !geteuid()) {
char *pp;
perror_msg("chown '%s'", pp = dirtree_path(try, 0));