Replace deprecated (or remove obsolete) libarchive 2.8 functions

with libarchive 3.0 counterparts
This commit is contained in:
mm 2013-03-22 10:17:42 +00:00
parent 91184d303f
commit af89cb16bf
5 changed files with 10 additions and 14 deletions

View File

@ -249,13 +249,12 @@ arscp_open(char *fname)
if ((a = archive_read_new()) == NULL)
bsdar_errc(bsdar, EX_SOFTWARE, 0, "archive_read_new failed");
archive_read_support_compression_none(a);
archive_read_support_format_ar(a);
AC(archive_read_open_file(a, fname, DEF_BLKSZ));
AC(archive_read_open_filename(a, fname, DEF_BLKSZ));
if ((r = archive_read_next_header(a, &entry)))
bsdar_warnc(bsdar, 0, "%s", archive_error_string(a));
AC(archive_read_close(a));
AC(archive_read_finish(a));
AC(archive_read_free(a));
if (r != ARCHIVE_OK)
return;
arscp_create(fname, fname);
@ -311,7 +310,7 @@ arscp_create(char *in, char *out)
archive_write_set_format_ar_svr4(a);
AC(archive_write_open_fd(a, ofd));
AC(archive_write_close(a));
AC(archive_write_finish(a));
AC(archive_write_free(a));
}
/* Override previous target, if any. */

View File

@ -87,9 +87,8 @@ read_archive(struct bsdar *bsdar, char mode)
if ((a = archive_read_new()) == NULL)
bsdar_errc(bsdar, EX_SOFTWARE, 0, "archive_read_new failed");
archive_read_support_compression_none(a);
archive_read_support_format_ar(a);
AC(archive_read_open_file(a, bsdar->filename, DEF_BLKSZ));
AC(archive_read_open_filename(a, bsdar->filename, DEF_BLKSZ));
for (;;) {
r = archive_read_next_header(a, &entry);
@ -200,5 +199,5 @@ read_archive(struct bsdar *bsdar, char mode)
}
}
AC(archive_read_close(a));
AC(archive_read_finish(a));
AC(archive_read_free(a));
}

View File

@ -277,7 +277,6 @@ read_objs(struct bsdar *bsdar, const char *archive, int checkargv)
if ((a = archive_read_new()) == NULL)
bsdar_errc(bsdar, EX_SOFTWARE, 0, "archive_read_new failed");
archive_read_support_compression_none(a);
archive_read_support_format_ar(a);
AC(archive_read_open_filename(a, archive, DEF_BLKSZ));
for (;;) {
@ -363,7 +362,7 @@ read_objs(struct bsdar *bsdar, const char *archive, int checkargv)
TAILQ_INSERT_TAIL(&bsdar->v_obj, obj, objs);
}
AC(archive_read_close(a));
AC(archive_read_finish(a));
AC(archive_read_free(a));
}
/*
@ -628,7 +627,6 @@ write_objs(struct bsdar *bsdar)
bsdar_errc(bsdar, EX_SOFTWARE, 0, "archive_write_new failed");
archive_write_set_format_ar_svr4(a);
archive_write_set_compression_none(a);
AC(archive_write_open_filename(a, bsdar->filename));
@ -682,7 +680,7 @@ write_objs(struct bsdar *bsdar)
}
AC(archive_write_close(a));
AC(archive_write_finish(a));
AC(archive_write_free(a));
}
/*

View File

@ -926,7 +926,7 @@ unzip(const char *fn)
}
ac(archive_read_close(a));
(void)archive_read_finish(a);
(void)archive_read_free(a);
if (t_opt) {
if (error_count > 0) {

View File

@ -126,7 +126,7 @@ count_files(const char *file)
/* Either we didn't have a manifest, or this archive wasn't there */
archive = archive_read_new();
archive_read_support_format_all(archive);
archive_read_support_compression_all(archive);
archive_read_support_filter_all(archive);
sprintf(path, "%s/%s", getenv("BSDINSTALL_DISTDIR"), file);
err = archive_read_open_filename(archive, path, 4096);
if (err != ARCHIVE_OK) {
@ -188,7 +188,7 @@ extract_files(int nfiles, const char **files)
for (i = 0; i < nfiles; i++) {
archive = archive_read_new();
archive_read_support_format_all(archive);
archive_read_support_compression_all(archive);
archive_read_support_filter_all(archive);
sprintf(path, "%s/%s", getenv("BSDINSTALL_DISTDIR"), files[i]);
err = archive_read_open_filename(archive, path, 4096);