svn commit: r191176 - head/lib/libarchive

Tim Kientzle kientzle at FreeBSD.org
Fri Apr 17 00:59:35 UTC 2009


Author: kientzle
Date: Fri Apr 17 00:59:34 2009
New Revision: 191176
URL: http://svn.freebsd.org/changeset/base/191176

Log:
  When pulling metadata from disk, lookup the user and group name at the same time.

Modified:
  head/lib/libarchive/archive_read_disk_entry_from_file.c

Modified: head/lib/libarchive/archive_read_disk_entry_from_file.c
==============================================================================
--- head/lib/libarchive/archive_read_disk_entry_from_file.c	Fri Apr 17 00:58:44 2009	(r191175)
+++ head/lib/libarchive/archive_read_disk_entry_from_file.c	Fri Apr 17 00:59:34 2009	(r191176)
@@ -42,6 +42,9 @@ __FBSDID("$FreeBSD$");
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
+#ifdef HAVE_SYS_XATTR_H
+#include <sys/xattr.h>
+#endif
 #ifdef HAVE_ACL_LIBACL_H
 #include <acl/libacl.h>
 #endif
@@ -84,7 +87,7 @@ archive_read_disk_entry_from_file(struct
     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_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()? */


More information about the svn-src-head mailing list