summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2011-06-23 11:43:13 +0000
committerotto <otto@openbsd.org>2011-06-23 11:43:13 +0000
commit9ef2f1fffd46b9a728efceceeadfef28a3427e4b (patch)
tree08d4d96819c1c6251b022c8c270c23c1ed0112aa
parentAdd a couple of extra xterm-style keys that gnome terminal provides, (diff)
downloadwireguard-openbsd-9ef2f1fffd46b9a728efceceeadfef28a3427e4b.tar.xz
wireguard-openbsd-9ef2f1fffd46b9a728efceceeadfef28a3427e4b.zip
set set*id bits only if the target did not exist and -p was not used;
from netbsd, prompted by Jesus Sanchez. ok miller@
-rw-r--r--bin/cp/utils.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/cp/utils.c b/bin/cp/utils.c
index 4a28cd50b2e..d17f1b2b8ad 100644
--- a/bin/cp/utils.c
+++ b/bin/cp/utils.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: utils.c,v 1.30 2009/10/27 23:59:21 deraadt Exp $ */
+/* $OpenBSD: utils.c,v 1.31 2011/06/23 11:43:13 otto Exp $ */
/* $NetBSD: utils.c,v 1.6 1997/02/26 14:40:51 cgd Exp $ */
/*-
@@ -178,7 +178,8 @@ copy_file(FTSENT *entp, int dne)
*/
#define RETAINBITS \
(S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
- else if (fs->st_mode & (S_ISUID | S_ISGID) && fs->st_uid == myuid) {
+ if (!pflag && dne &&
+ fs->st_mode & (S_ISUID | S_ISGID) && fs->st_uid == myuid) {
if (fstat(to_fd, &to_stat)) {
warn("%s", to.p_path);
rval = 1;