aboutsummaryrefslogtreecommitdiffstats
path: root/cpio
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2017-03-20 11:12:31 +0000
committerMartin Matuska <mm@FreeBSD.org>2017-03-20 11:12:31 +0000
commit4a7f6834348e3853977e1b7d69ff44f6eb93313c (patch)
tree27f68e9bbe812cb11d4094911825d437242a25d7 /cpio
parent086ca70a2894f87d7cd5ac72a6d891b00d5b4dc5 (diff)
downloadsrc-4a7f6834348e3853977e1b7d69ff44f6eb93313c.tar.gz
src-4a7f6834348e3853977e1b7d69ff44f6eb93313c.zip
Update vendor/libarchive to git 5881c9021a85668bd945593f5ba43a0d22c53d71
Vendor changes (FreeBSD-related): Break ACL read/write code into platform-specific source files Vendor bugfixes (FreeBSD-related): PR 867 (bsdcpio): show numeric uid/gid when names are not found PR 870 (seekable zip): accept files with valid ZIP64 EOCD headers PR 880 (pax): Fix handling of "size" pax header keyword PR 887 (crypto): Discard 3072 bytes instead of 1024 of first keystream OSS-Fuzz issue 806 (mtree): rework mtree_atol10 integer parser Unbreak static dependency on libbz2
Notes
Notes: svn path=/vendor/libarchive/dist/; revision=315633
Diffstat (limited to 'cpio')
-rw-r--r--cpio/cpio.c46
-rw-r--r--cpio/test/CMakeLists.txt7
2 files changed, 28 insertions, 25 deletions
diff --git a/cpio/cpio.c b/cpio/cpio.c
index d7bb9c469f73..1691c756599e 100644
--- a/cpio/cpio.c
+++ b/cpio/cpio.c
@@ -1344,23 +1344,23 @@ lookup_name(struct cpio *cpio, struct name_cache **name_cache_variable,
cache->cache[slot].name = NULL;
}
- if (lookup_fn(cpio, &name, id) == 0) {
- if (name == NULL || name[0] == '\0') {
- /* If lookup failed, format it as a number. */
- snprintf(asnum, sizeof(asnum), "%u", (unsigned)id);
- name = asnum;
- }
- cache->cache[slot].name = strdup(name);
- if (cache->cache[slot].name != NULL) {
- cache->cache[slot].id = id;
- return (cache->cache[slot].name);
- }
- /*
- * Conveniently, NULL marks an empty slot, so
- * if the strdup() fails, we've just failed to
- * cache it. No recovery necessary.
- */
+ if (lookup_fn(cpio, &name, id)) {
+ /* If lookup failed, format it as a number. */
+ snprintf(asnum, sizeof(asnum), "%u", (unsigned)id);
+ name = asnum;
+ }
+
+ cache->cache[slot].name = strdup(name);
+ if (cache->cache[slot].name != NULL) {
+ cache->cache[slot].id = id;
+ return (cache->cache[slot].name);
}
+
+ /*
+ * Conveniently, NULL marks an empty slot, so
+ * if the strdup() fails, we've just failed to
+ * cache it. No recovery necessary.
+ */
return (NULL);
}
@@ -1381,15 +1381,14 @@ lookup_uname_helper(struct cpio *cpio, const char **name, id_t id)
errno = 0;
pwent = getpwuid((uid_t)id);
if (pwent == NULL) {
- *name = NULL;
- if (errno != 0 && errno != ENOENT)
+ if (errno && errno != ENOENT)
lafe_warnc(errno, "getpwuid(%s) failed",
cpio_i64toa((int64_t)id));
- return (errno);
+ return 1;
}
*name = pwent->pw_name;
- return (0);
+ return 0;
}
static const char *
@@ -1409,15 +1408,14 @@ lookup_gname_helper(struct cpio *cpio, const char **name, id_t id)
errno = 0;
grent = getgrgid((gid_t)id);
if (grent == NULL) {
- *name = NULL;
- if (errno != 0)
+ if (errno && errno != ENOENT)
lafe_warnc(errno, "getgrgid(%s) failed",
cpio_i64toa((int64_t)id));
- return (errno);
+ return 1;
}
*name = grent->gr_name;
- return (0);
+ return 0;
}
/*
diff --git a/cpio/test/CMakeLists.txt b/cpio/test/CMakeLists.txt
index cc5fe0117db3..4c3fb88a61fd 100644
--- a/cpio/test/CMakeLists.txt
+++ b/cpio/test/CMakeLists.txt
@@ -63,9 +63,14 @@ IF(ENABLE_CPIO AND ENABLE_TEST)
#
ADD_EXECUTABLE(bsdcpio_test ${bsdcpio_test_SOURCES})
IF(ENABLE_ACL)
+ SET(TEST_ACL_LIBS "")
IF(HAVE_LIBACL)
- TARGET_LINK_LIBRARIES(bsdcpio_test ${ACL_LIBRARY})
+ LIST(APPEND TEST_ACL_LIBS ${ACL_LIBRARY})
ENDIF(HAVE_LIBACL)
+ IF(HAVE_LIBRICHACL)
+ LIST(APPEND TEST_ACL_LIBS ${RICHACL_LIBRARY})
+ ENDIF(HAVE_LIBRICHACL)
+ TARGET_LINK_LIBRARIES(bsdcpio_test ${TEST_ACL_LIBS})
ENDIF(ENABLE_ACL)
SET_PROPERTY(TARGET bsdcpio_test PROPERTY COMPILE_DEFINITIONS LIST_H)