From 14086ec084cde031ddfc95eb2c794497255fbb4c Mon Sep 17 00:00:00 2001 From: kientzle Date: Fri, 17 Apr 2009 00:59:34 +0000 Subject: [PATCH] When pulling metadata from disk, lookup the user and group name at the same time. --- lib/libarchive/archive_read_disk_entry_from_file.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/libarchive/archive_read_disk_entry_from_file.c b/lib/libarchive/archive_read_disk_entry_from_file.c index ef06faa3ac74..6e12517b5e58 100644 --- a/lib/libarchive/archive_read_disk_entry_from_file.c +++ b/lib/libarchive/archive_read_disk_entry_from_file.c @@ -42,6 +42,9 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include #endif +#ifdef HAVE_SYS_XATTR_H +#include +#endif #ifdef HAVE_ACL_LIBACL_H #include #endif @@ -84,7 +87,7 @@ archive_read_disk_entry_from_file(struct archive *_a, int fd, const struct stat *st) { struct archive_read_disk *a = (struct archive_read_disk *)_a; - const char *path; + const char *path, *name; struct stat s; int initial_fd = fd; int r, r1; @@ -128,6 +131,14 @@ archive_read_disk_entry_from_file(struct archive *_a, } archive_entry_copy_stat(entry, st); + /* Lookup uname/gname */ + name = archive_read_disk_uname(_a, archive_entry_uid(entry)); + if (name != NULL) + archive_entry_copy_uname(entry, name); + name = archive_read_disk_gname(_a, archive_entry_gid(entry)); + if (name != NULL) + archive_entry_copy_gname(entry, name); + #ifdef HAVE_STRUCT_STAT_ST_FLAGS /* On FreeBSD, we get flags for free with the stat. */ /* TODO: Does this belong in copy_stat()? */