From a7b841a801f8885b666e355b3d3c6684f9152792 Mon Sep 17 00:00:00 2001 From: Keith Bostic Date: Sun, 28 Jun 1992 21:56:19 -0800 Subject: [PATCH] -p option should preserve file flags as well SCCS-vsn: bin/cp/cp.1 6.19 SCCS-vsn: bin/cp/utils.c 5.5 --- usr/src/bin/cp/cp.1 | 4 ++-- usr/src/bin/cp/utils.c | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/usr/src/bin/cp/cp.1 b/usr/src/bin/cp/cp.1 index 4bcf891a8f..d420fd3178 100644 --- a/usr/src/bin/cp/cp.1 +++ b/usr/src/bin/cp/cp.1 @@ -6,7 +6,7 @@ .\" .\" %sccs.include.redist.roff% .\" -.\" @(#)cp.1 6.18 (Berkeley) %G% +.\" @(#)cp.1 6.19 (Berkeley) %G% .\" .Dd .Dt CP 1 @@ -84,7 +84,7 @@ the file is copied if permissions allow the copy. Causes .Nm cp to preserve in the copy as many of the modification time, access time, -file mode, user ID, and group ID as allowed by permissions. +file flags, file mode, user ID, and group ID as allowed by permissions. .Pp If the user ID and group ID cannot be preserved, no error message is displayed and the exit value is not altered. diff --git a/usr/src/bin/cp/utils.c b/usr/src/bin/cp/utils.c index 913be97345..3aeea74bd7 100644 --- a/usr/src/bin/cp/utils.c +++ b/usr/src/bin/cp/utils.c @@ -6,7 +6,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)utils.c 5.4 (Berkeley) %G%"; +static char sccsid[] = "@(#)utils.c 5.5 (Berkeley) %G%"; #endif /* not lint */ #include @@ -196,6 +196,9 @@ setfile(fs, fd) } if (fd ? fchmod(fd, fs->st_mode) : chmod(to.p_path, fs->st_mode)) err("chown: %s: %s", to.p_path, strerror(errno)); + + if (fd ? fchflags(fd, fs->st_flags) : chflags(to.p_path, fs->st_flags)) + err("chflags: %s: %s", to.p_path, strerror(errno)); } void -- 2.20.1