diff --git a/libpkg/pkg_add.c b/libpkg/pkg_add.c index 075dc0f..88b0c18 100644 --- a/libpkg/pkg_add.c +++ b/libpkg/pkg_add.c @@ -124,7 +124,12 @@ do_extract_mtree(char *mtree, const char *prefix) goto cleanup; } - while ((ret = archive_read_next_header(a, &ae)) == ARCHIVE_OK) { + while ((ret = archive_read_next_header(a, &ae)) != ARCHIVE_EOF) { + if (ret != ARCHIVE_OK) { + pkg_emit_error("Skip I don't know what to say: %s", + archive_error_string(a)); + continue; + } fpath = archive_entry_pathname(ae); if (*fpath != '/') { @@ -140,12 +145,6 @@ do_extract_mtree(char *mtree, const char *prefix) } } - if (ret != ARCHIVE_EOF) { - pkg_emit_error("Fail to walk in the mtree file: %s", - archive_error_string(a)); - retcode = EPKG_FATAL; - } - cleanup: if (a != NULL) archive_read_finish(a);