summaryrefslogtreecommitdiffstats
path: root/usr.bin/tar/write.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/tar/write.c')
-rw-r--r--usr.bin/tar/write.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/usr.bin/tar/write.c b/usr.bin/tar/write.c
index 32e43c6..a0a9b75 100644
--- a/usr.bin/tar/write.c
+++ b/usr.bin/tar/write.c
@@ -833,6 +833,24 @@ write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path)
#endif
r = archive_read_disk_entry_from_file(bsdtar->diskreader,
entry, -1, st);
+ if (bsdtar->uid >= 0) {
+ archive_entry_set_uid(entry, bsdtar->uid);
+ if (!bsdtar->uname)
+ archive_entry_set_uname(entry,
+ archive_read_disk_uname(bsdtar->diskreader,
+ bsdtar->uid));
+ }
+ if (bsdtar->gid >= 0) {
+ archive_entry_set_gid(entry, bsdtar->gid);
+ if (!bsdtar->gname)
+ archive_entry_set_gname(entry,
+ archive_read_disk_gname(bsdtar->diskreader,
+ bsdtar->gid));
+ }
+ if (bsdtar->uname)
+ archive_entry_set_uname(entry, bsdtar->uname);
+ if (bsdtar->gname)
+ archive_entry_set_gname(entry, bsdtar->gname);
if (r != ARCHIVE_OK)
lafe_warnc(archive_errno(bsdtar->diskreader),
"%s", archive_error_string(bsdtar->diskreader));
OpenPOWER on IntegriCloud