From: Xiang Fan Date: Wed, 1 Feb 2017 15:50:23 +0000 (+0000) Subject: cp: set rc properly X-Git-Tag: android-x86-7.1-r1~1 X-Git-Url: http://git.osdn.net/view?p=android-x86%2Fexternal-toybox.git;a=commitdiff_plain;h=39eedbfb3d53fcbaa28caf4e32e360245c40b2e2 cp: set rc properly This fixes the failure when going through symlinks. Change-Id: If0e2959356312b44ad9e93a2b35f4d60acb52777 --- diff --git a/toys/posix/cp.c b/toys/posix/cp.c index 6e035f77..0dd63a7d 100644 --- a/toys/posix/cp.c +++ b/toys/posix/cp.c @@ -315,7 +315,7 @@ int cp_node(struct dirtree *try) // permission bits already correct for mknod and don't apply to symlink // If we can't get a filehandle to the actual object, use racy functions if (fdout == AT_FDCWD) - fchownat(cfd, catch, try->st.st_uid, try->st.st_gid, + 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 && !geteuid()) {