From: Tim Kientzle Date: Tue, 7 Dec 2010 05:02:31 +0000 (-0500) Subject: Don't try to copy entry data if the entry has zero size. X-Git-Tag: v2.8.5~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3cfd0becf8f0f60680374ef44ccd38d841a93d85;p=thirdparty%2Flibarchive.git Don't try to copy entry data if the entry has zero size. In particular, this causes "Cannot write to empty file" errors when extracting GNU tar extended 'D' directory entries. SVN-Revision: 2816 --- diff --git a/libarchive/archive_read_extract.c b/libarchive/archive_read_extract.c index e1027995e..ea44f7b88 100644 --- a/libarchive/archive_read_extract.c +++ b/libarchive/archive_read_extract.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_read_extract.c,v 1.61 2008/05/26 #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);