From 4cf8a72f550e6299138e336ab9f0d37c6b197dd4 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Tue, 31 May 2016 17:33:23 -0500 Subject: [PATCH] In cp -a, don't complain if non-root user can't chown, failure is expected. --- toys/posix/cp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)); -- 2.11.0