aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
Diffstat (limited to 'toys')
-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));