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
This commit is contained in:
Tim Kientzle 2008-07-30 03:35:45 +00:00
parent 76c683bef7
commit 979b646f30
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=180987

View File

@ -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;