Date: Wed, 17 Dec 2008 19:05:00 +0000 (UTC) From: Tim Kientzle <kientzle@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r186246 - head/lib/libarchive/test Message-ID: <200812171905.mBHJ50D5012561@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kientzle Date: Wed Dec 17 19:05:00 2008 New Revision: 186246 URL: http://svn.freebsd.org/changeset/base/186246 Log: Once the test has failed, exit before the segfault. Modified: head/lib/libarchive/test/test_compat_gtar.c Modified: head/lib/libarchive/test/test_compat_gtar.c ============================================================================== --- head/lib/libarchive/test/test_compat_gtar.c Wed Dec 17 19:03:44 2008 (r186245) +++ head/lib/libarchive/test/test_compat_gtar.c Wed Dec 17 19:05:00 2008 (r186246) @@ -43,6 +43,7 @@ test_compat_gtar_1(void) char name[] = "test_compat_gtar_1.tgz"; struct archive_entry *ae; struct archive *a; + int r; assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a)); @@ -51,7 +52,11 @@ test_compat_gtar_1(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240)); /* Read first entry. */ - assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_OK, r = archive_read_next_header(a, &ae)); + if (r != ARCHIVE_OK) { + archive_read_finish(a); + return; + } assertEqualString( "12345678901234567890123456789012345678901234567890" "12345678901234567890123456789012345678901234567890" @@ -66,7 +71,11 @@ test_compat_gtar_1(void) assertEqualInt(0100644, archive_entry_mode(ae)); /* Read second entry. */ - assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_OK, r = archive_read_next_header(a, &ae)); + if (r != ARCHIVE_OK) { + archive_read_finish(a); + return; + } assertEqualString( "abcdefghijabcdefghijabcdefghijabcdefghijabcdefghij" "abcdefghijabcdefghijabcdefghijabcdefghijabcdefghij"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812171905.mBHJ50D5012561>