]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Don't try to copy entry data if the entry has zero size.
authorTim Kientzle <kientzle@gmail.com>
Tue, 7 Dec 2010 05:02:31 +0000 (00:02 -0500)
committerTim Kientzle <kientzle@gmail.com>
Tue, 7 Dec 2010 05:02:31 +0000 (00:02 -0500)
In particular, this causes "Cannot write to empty file" errors
when extracting GNU tar extended 'D' directory entries.

SVN-Revision: 2816

libarchive/archive_read_extract.c

index e1027995ec0cf12f4816c312add0a63918a4bf60..ea44f7b8810c65f81e1ff833cb1f009e7d580e45 100644 (file)
@@ -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);