summaryrefslogtreecommitdiffstats
path: root/lib/libarchive
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2010-12-07 16:48:01 +0000
committerkientzle <kientzle@FreeBSD.org>2010-12-07 16:48:01 +0000
commit7aa4e35a24d07cbf7ef35c26ef7ac092a2f54e5e (patch)
tree3abf8d1aa3e70fde88f413ecd9066e7f3a980481 /lib/libarchive
parentbda3b883cdac9ecfd7bebcd783d32f31cf3c4463 (diff)
downloadFreeBSD-src-7aa4e35a24d07cbf7ef35c26ef7ac092a2f54e5e.zip
FreeBSD-src-7aa4e35a24d07cbf7ef35c26ef7ac092a2f54e5e.tar.gz
Don't write data into an empty "file."
In particular, this check avoids a warning when extracting directory entries from certain GNU tar archives that store directory contents. MFC after: 3 days
Diffstat (limited to 'lib/libarchive')
-rw-r--r--lib/libarchive/archive_read_extract.c3
-rw-r--r--lib/libarchive/test/Makefile17
-rw-r--r--lib/libarchive/test/test_acl_freebsd.c5
3 files changed, 12 insertions, 13 deletions
diff --git a/lib/libarchive/archive_read_extract.c b/lib/libarchive/archive_read_extract.c
index 86b378b..8ae5dec 100644
--- a/lib/libarchive/archive_read_extract.c
+++ b/lib/libarchive/archive_read_extract.c
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#endif
#include "archive.h"
+#include "archive_entry.h"
#include "archive_private.h"
#include "archive_read_private.h"
#include "archive_write_disk_private.h"
@@ -107,7 +108,7 @@ archive_read_extract2(struct archive *_a, struct archive_entry *entry,
if (r != ARCHIVE_OK)
/* If _write_header failed, copy the error. */
archive_copy_error(&a->archive, ad);
- else
+ else if (archive_entry_size(entry) > 0)
/* Otherwise, pour data into the entry. */
r = copy_data(_a, ad);
r2 = archive_write_finish_entry(ad);
diff --git a/lib/libarchive/test/Makefile b/lib/libarchive/test/Makefile
index c721f57..f9fead9 100644
--- a/lib/libarchive/test/Makefile
+++ b/lib/libarchive/test/Makefile
@@ -2,10 +2,6 @@
# Where to find the libarchive sources
LA_SRCDIR=${.CURDIR}/..
-.PATH: ${LA_SRCDIR}
-
-# Get a list of all libarchive source files
-LA_SRCS!=make -f ${LA_SRCDIR}/Makefile -V SRCS
TESTS= \
test_acl_basic.c \
@@ -113,8 +109,8 @@ TESTS= \
test_write_open_memory.c
-# Build the test program using all libarchive sources + the test sources.
-SRCS= ${LA_SRCS} \
+# Build the test program.
+SRCS= \
${TESTS} \
list.h \
main.c \
@@ -125,14 +121,11 @@ NO_MAN=yes
PROG=libarchive_test
INTERNALPROG=yes # Don't install this; it's just for testing
DPADD=${LIBBZ2} ${LIBZ} ${LIBMD} ${LIBCRYPTO} ${LIBBSDXML}
-CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\"
-LDADD= -lz -lbz2 -lmd -lcrypto -lbsdxml
+LDADD= -L ${.OBJDIR}/.. -larchive
+LDADD+= -lz -lbz2 -llzma -lmd -lcrypto -lbsdxml
CFLAGS+= -g
CFLAGS+= -I${LA_SRCDIR} -I.
-
-# Uncomment to build and test lzma and xz support via liblzma
-#CFLAGS+= -I/usr/local/include -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1
-#LDADD+= -L/usr/local/lib -llzma
+CFLAGS+= -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1
# Uncomment to link against dmalloc
#LDADD+= -L/usr/local/lib -ldmalloc
diff --git a/lib/libarchive/test/test_acl_freebsd.c b/lib/libarchive/test/test_acl_freebsd.c
index 88efb19..fbb744d 100644
--- a/lib/libarchive/test/test_acl_freebsd.c
+++ b/lib/libarchive/test/test_acl_freebsd.c
@@ -220,6 +220,11 @@ DEFINE_TEST(test_acl_freebsd)
skipping("ACL tests require that ACL support be enabled on the filesystem");
return;
}
+ if (n != 0 && errno == EINVAL) {
+ close(fd);
+ skipping("POSIX.1e ACL tests require that POSIX.1e ACL support be enabled on the filesystem");
+ return;
+ }
failure("acl_set_fd(): errno = %d (%s)",
errno, strerror(errno));
assertEqualInt(0, n);
OpenPOWER on IntegriCloud