Preserve ownership if cpio is run as root.

This commit is contained in:
Tim Kientzle 2008-07-06 16:39:18 +00:00
parent ded2471528
commit af03c60c06
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=180328

View File

@ -111,7 +111,8 @@ 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;
/* TODO: If run by root, set owner as well. */
if (geteuid() == 0)
cpio->extract_flags |= ARCHIVE_EXTRACT_OWNER;
cpio->bytes_per_block = 512;
cpio->filename = NULL;