diff options
author | kientzle <kientzle@FreeBSD.org> | 2004-04-05 21:12:29 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2004-04-05 21:12:29 +0000 |
commit | 775d07093eb7dc5701457147a8404f0eae443538 (patch) | |
tree | 65c99eaf5f048beaa6a7d9973eb8410048b1f15d /lib/libarchive/archive_read.c | |
parent | 74cf37bd00b1e09a0b991b7b1edd335d8e0c2355 (diff) | |
download | FreeBSD-src-775d07093eb7dc5701457147a8404f0eae443538.zip FreeBSD-src-775d07093eb7dc5701457147a8404f0eae443538.tar.gz |
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.
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 a6da35a..bb89eeb 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); } |