summaryrefslogtreecommitdiffstats
path: root/usr.bin/cpio
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2008-07-30 03:35:45 +0000
committerkientzle <kientzle@FreeBSD.org>2008-07-30 03:35:45 +0000
commit1e5899ea8b9164e8360d3fda61a0c134471ce14f (patch)
tree5d17ea0923ea9ff1b8e03fa360eb8506ef5c3725 /usr.bin/cpio
parenta3f8092a7b2a46172361ff2cacba5858162a9630 (diff)
downloadFreeBSD-src-1e5899ea8b9164e8360d3fda61a0c134471ce14f.zip
FreeBSD-src-1e5899ea8b9164e8360d3fda61a0c134471ce14f.tar.gz
MfP4: Preserve permissions by default.
In particular, this fixes the oddity that -dumpl would apply umask to copied dirs (which are created in the target tree) but not to "copied" files (which are only linked). After this change: $ ls -ld a a/b a/b/c d--x-w-r-- 3 tim tim 512 Jul 29 20:08 a drwxr----x 3 tim tim 512 Jul 29 20:09 a/b dr----x-w- 2 tim tim 512 Jul 29 20:09 a/b/c $ (echo a; echo a/b; echo a/b/c) | cpio -dumpl o $ cd o $ ls -ld a a/b a/b/c d--x-w-r-- 3 tim tim 512 Jul 29 20:08 a drwxr----x 3 tim tim 512 Jul 29 20:09 a/b dr----x-w- 2 tim tim 512 Jul 29 20:09 a/b/c
Diffstat (limited to 'usr.bin/cpio')
-rw-r--r--usr.bin/cpio/cpio.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/usr.bin/cpio/cpio.c b/usr.bin/cpio/cpio.c
index 991e871..d79003f 100644
--- a/usr.bin/cpio/cpio.c
+++ b/usr.bin/cpio/cpio.c
@@ -111,6 +111,7 @@ main(int argc, char *argv[])
cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_PERM;
if (geteuid() == 0)
cpio->extract_flags |= ARCHIVE_EXTRACT_OWNER;
cpio->bytes_per_block = 512;
OpenPOWER on IntegriCloud