summaryrefslogtreecommitdiffstats
path: root/bin/cp/cp.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/cp/cp.c')
-rw-r--r--bin/cp/cp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/bin/cp/cp.c b/bin/cp/cp.c
index 1007209..57c3e4d 100644
--- a/bin/cp/cp.c
+++ b/bin/cp/cp.c
@@ -361,9 +361,10 @@ copy(char *argv[], enum op type, int fts_options)
* honour setuid, setgid and sticky bits, but we
* normally want to preserve them on directories.
*/
- if (pflag)
- rval = setfile(curr->fts_statp, 0);
- else {
+ if (pflag) {
+ if (setfile(curr->fts_statp, 0))
+ rval = 1;
+ } else {
mode = curr->fts_statp->st_mode;
if ((mode & (S_ISUID | S_ISGID | S_ISTXT)) ||
((mode | S_IRWXU) & mask) != (mode & mask))
OpenPOWER on IntegriCloud