diff options
author | joerg <joerg@pkgsrc.org> | 2008-02-26 13:09:20 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2008-02-26 13:09:20 +0000 |
commit | 840b7e50a88a271ecaf658715d717f1874dec4cf (patch) | |
tree | b1d6c54983a131a38eb3811e784be451aaf76330 /archivers/libarchive/files/libarchive/test/test_write_disk.c | |
parent | 716563bc0c4cdde2939f9371a03b69812faff736 (diff) | |
download | pkgsrc-840b7e50a88a271ecaf658715d717f1874dec4cf.tar.gz |
Import libarchive-2.4.13. This brings a number of bugfixes, support for
more ZIP archives and a more complete cpio frontend.
Diffstat (limited to 'archivers/libarchive/files/libarchive/test/test_write_disk.c')
-rw-r--r-- | archivers/libarchive/files/libarchive/test/test_write_disk.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/archivers/libarchive/files/libarchive/test/test_write_disk.c b/archivers/libarchive/files/libarchive/test/test_write_disk.c index 4cac97681a7..480cf29b566 100644 --- a/archivers/libarchive/files/libarchive/test/test_write_disk.c +++ b/archivers/libarchive/files/libarchive/test/test_write_disk.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk.c,v 1.6 2007/09/21 04:52:43 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk.c,v 1.8 2008/01/23 05:47:08 kientzle Exp $"); #if ARCHIVE_VERSION_STAMP >= 1009000 @@ -60,6 +60,24 @@ static void create_reg_file(struct archive_entry *ae, const char *msg) /* Write the entry to disk. */ assert((ad = archive_write_disk_new()) != NULL); failure("%s", msg); + /* + * A touchy API design issue: archive_write_data() does (as of + * 2.4.12) enforce the entry size as a limit on the data + * written to the file. This was not enforced prior to + * 2.4.12. The change was prompted by the refined + * hardlink-restore semantics introduced at that time. In + * short, libarchive needs to know whether a "hardlink entry" + * is going to overwrite the contents so that it can know + * whether or not to open the file for writing. This implies + * that there is a fundamental semantic difference between an + * entry with a zero size and one with a non-zero size in the + * case of hardlinks and treating the hardlink case + * differently from the regular file case is just asking for + * trouble. So, a zero size must always mean that no data + * will be accepted, which is consistent with the file size in + * the entry being a maximum size. + */ + archive_entry_set_size(ae, sizeof(data)); assertEqualIntA(ad, 0, archive_write_header(ad, ae)); assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data))); assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); @@ -92,6 +110,11 @@ static void create_reg_file2(struct archive_entry *ae, const char *msg) /* Write the entry to disk. */ assert((ad = archive_write_disk_new()) != NULL); failure("%s", msg); + /* + * See above for an explanation why this next call + * is necessary. + */ + archive_entry_set_size(ae, datasize); assertEqualIntA(ad, 0, archive_write_header(ad, ae)); for (i = 0; i < datasize - 999; i += 1000) { assertEqualIntA(ad, ARCHIVE_OK, |