diff options
author | Tim Kientzle <kientzle@FreeBSD.org> | 2004-04-05 21:12:29 +0000 |
---|---|---|
committer | Tim Kientzle <kientzle@FreeBSD.org> | 2004-04-05 21:12:29 +0000 |
commit | 71b44796d9533309abbe22e7b26d3ee5bb3d0251 (patch) | |
tree | 65c99eaf5f048beaa6a7d9973eb8410048b1f15d /lib/libarchive/archive_read.c | |
parent | 7f8a436ff29ebeb1ce2ae2434add4505d5e7e2ca (diff) |
Overhauled ACL support. This makes us compatible
with 'star' ACL handling, though there's still a
bit more work needed in this area.
Added 'write_open_fd' and 'read_open_fd' to simplify, e.g.,
tar's u and r modes. Eliminated old 'write_open_file_position'
as a bad idea. (It required closing/reopening files to
do updates, which led to unpleasant implications.)
Various other minor fixes, API tweaks, etc.
Notes
Notes:
svn path=/head/; revision=127912
Diffstat (limited to 'lib/libarchive/archive_read.c')
-rw-r--r-- | lib/libarchive/archive_read.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/libarchive/archive_read.c b/lib/libarchive/archive_read.c index a6da35a60fd8..bb89eeb1d7ea 100644 --- a/lib/libarchive/archive_read.c +++ b/lib/libarchive/archive_read.c @@ -405,6 +405,9 @@ archive_read_data_skip(struct archive *a) void archive_read_finish(struct archive *a) { + int i; + int slots; + archive_check_magic(a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_ANY); a->state = ARCHIVE_STATE_CLOSED; @@ -418,23 +421,21 @@ archive_read_finish(struct archive *a) if (a->compression_finish != NULL) (a->compression_finish)(a); - /*- - * Release allocated strings. - * - * TODO: Add a "cleanup" column to the "formats" array and - * use that to cleanup format-specific data. E.g., - * - * for (i=0; i< slots; i++) { - * if (a->formats[i].cleanup) - * (a->formats[i].cleanup)(a); - * } - */ + /* Cleanup format-specific data. */ + slots = sizeof(a->formats) / sizeof(a->formats[0]); + for (i = 0; i < slots; i++) { + a->pformat_data = &(a->formats[i].format_data); + if (a->formats[i].cleanup) + (a->formats[i].cleanup)(a); + } + /* Casting a pointer to int allows us to remove 'const.' */ free((void *)(uintptr_t)(const void *)a->nulls); if (a->extract_mkdirpath.s != NULL) free(a->extract_mkdirpath.s); if (a->entry) archive_entry_free(a->entry); + a->magic = 0; free(a); } |