summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/test/test_write_disk_hardlink.c
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2008-05-26 17:00:24 +0000
committerkientzle <kientzle@FreeBSD.org>2008-05-26 17:00:24 +0000
commita24d28f8e3d3892010c91baad77e2178c6a16ba2 (patch)
treed200bbdabe22d32b68a61172999be232d0c31d75 /lib/libarchive/test/test_write_disk_hardlink.c
parent268a4c430f25bc479b5e1e097f51394aa0f1fffb (diff)
downloadFreeBSD-src-a24d28f8e3d3892010c91baad77e2178c6a16ba2.zip
FreeBSD-src-a24d28f8e3d3892010c91baad77e2178c6a16ba2.tar.gz
MFp4: libarchive 2.5.4b. (Still 'b' until I get a bit more
feedback, but the 2.5 branch is shaping up nicely.) In addition to many small bug fixes and code improvements: * Another iteration of versioning; I think I've got it right now. * Portability: A lot of progress on Windows support (though I'm not committing all of the Windows support files to FreeBSD CVS) * Explicit tracking of MBS, WCS, and UTF-8 versions of strings in archive_entry; the archive_entry routines now correctly return NULL only when something is unset, setting NULL properly clears string values. Most charset conversions have been pushed down to archive_string. * Better handling of charset conversion failure when writing or reading UTF-8 headers in pax archives * archive_entry_linkify() provides multiple strategies for hardlink matching to suit different format expectations * More accurate bzip2 format detection * Joerg Sonnenberger's extensive improvements to mtree support * Rough support for self-extracting ZIP archives. Not an ideal approach, but it works for the archives I've tried. * New "sparsify" option in archive_write_disk converts blocks of nulls into seeks. * Better default behavior for the test harness; it now reports all failures by default instead of coredumping at the first one.
Diffstat (limited to 'lib/libarchive/test/test_write_disk_hardlink.c')
-rw-r--r--lib/libarchive/test/test_write_disk_hardlink.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/libarchive/test/test_write_disk_hardlink.c b/lib/libarchive/test/test_write_disk_hardlink.c
index 108fcbd..76969d1 100644
--- a/lib/libarchive/test/test_write_disk_hardlink.c
+++ b/lib/libarchive/test/test_write_disk_hardlink.c
@@ -29,6 +29,10 @@ __FBSDID("$FreeBSD$");
/*
* Exercise hardlink recreation.
+ *
+ * File permissions are chosen so that the authoritive entry
+ * has the correct permission and the non-authoritive versions
+ * are just writeable files.
*/
DEFINE_TEST(test_write_disk_hardlink)
{
@@ -64,7 +68,7 @@ DEFINE_TEST(test_write_disk_hardlink)
/* Link. */
assert((ae = archive_entry_new()) != NULL);
archive_entry_copy_pathname(ae, "link1b");
- archive_entry_set_mode(ae, S_IFREG | 0755);
+ archive_entry_set_mode(ae, S_IFREG | 0600);
archive_entry_set_size(ae, 0);
archive_entry_copy_hardlink(ae, "link1a");
assertEqualIntA(ad, 0, archive_write_header(ad, ae));
@@ -80,7 +84,7 @@ DEFINE_TEST(test_write_disk_hardlink)
/* Regular file. */
assert((ae = archive_entry_new()) != NULL);
archive_entry_copy_pathname(ae, "link2a");
- archive_entry_set_mode(ae, S_IFREG | 0755);
+ archive_entry_set_mode(ae, S_IFREG | 0600);
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)));
@@ -106,10 +110,14 @@ DEFINE_TEST(test_write_disk_hardlink)
/* Regular file. */
assert((ae = archive_entry_new()) != NULL);
archive_entry_copy_pathname(ae, "link3a");
- archive_entry_set_mode(ae, S_IFREG | 0755);
+ archive_entry_set_mode(ae, S_IFREG | 0600);
archive_entry_set_size(ae, 0);
assertEqualIntA(ad, 0, archive_write_header(ad, ae));
- assertEqualInt(0, archive_write_data(ad, data, sizeof(data)));
+#if ARCHIVE_VERSION_NUMBER < 3000000
+ assertEqualInt(ARCHIVE_WARN, archive_write_data(ad, data, 1));
+#else
+ assertEqualInt(-1, archive_write_data(ad, data, 1));
+#endif
assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
archive_entry_free(ae);
OpenPOWER on IntegriCloud