Add --no-same-owner and --no-same-permissions options to tar.

This commit is contained in:
Rob Landley
2005-10-27 22:49:08 +00:00
parent 47ea7b7f96
commit f3d6c94c7f
3 changed files with 64 additions and 41 deletions

View File

@ -111,8 +111,12 @@ extern void data_extract_all(archive_handle_t *archive_handle)
}
}
lchown(file_header->name, file_header->uid, file_header->gid);
if ((file_header->mode & S_IFMT) != S_IFLNK) {
if (!(archive_handle->flags & ARCHIVE_NOPRESERVE_OWN)) {
lchown(file_header->name, file_header->uid, file_header->gid);
}
if (!(archive_handle->flags & ARCHIVE_NOPRESERVE_PERM) &&
(file_header->mode & S_IFMT) != S_IFLNK)
{
chmod(file_header->name, file_header->mode);
}