Commit 1e23b458 authored by Allan McRae's avatar Allan McRae
Browse files

Fix documentation of alpm_mtree_next and remove libarchive exposure



The documentation of the return types of alpm_mtree_next was incorrect.
This extended into the relevant function in be_local.c.

Also, return explicit integer values, rather than the ARCHIVE_xxx values,
to avoid unnecessarily exposing frontends to libarchive internals (even
though it makes no functional difference).

Original-work-by: Morgan Adamiec's avatarmorganamilo <morganamilo@archlinux.org>
Signed-off-by: Allan McRae's avatarAllan McRae <allan@archlinux.org>
parent 3073752b
......@@ -1329,7 +1329,7 @@ struct archive *alpm_pkg_mtree_open(alpm_pkg_t *pkg);
* @param pkg the package that the mtree file is being read from
* @param archive the archive structure reading from the mtree file
* @param entry an archive_entry to store the entry header information
* @return 0 if end of archive is reached, non-zero otherwise.
* @return 0 on success, 1 if end of archive is reached, -1 otherwise.
*/
int alpm_pkg_mtree_next(const alpm_pkg_t *pkg, struct archive *archive,
struct archive_entry **entry);
......
......@@ -284,12 +284,26 @@ error:
* @param pkg the package that the mtree file is being read from
* @param archive the archive structure reading from the mtree file
* @param entry an archive_entry to store the entry header information
* @return 0 if end of archive is reached, non-zero otherwise.
* @return 0 on success, 1 if end of archive is reached, -1 otherwise.
*/
static int _cache_mtree_next(const alpm_pkg_t UNUSED *pkg,
struct archive *mtree, struct archive_entry **entry)
{
return archive_read_next_header(mtree, entry);
int ret;
ret = archive_read_next_header(mtree, entry);
switch(ret) {
case ARCHIVE_OK:
return 0;
break;
case ARCHIVE_EOF:
return 1;
break;
default:
break;
}
return -1;
}
/**
......
......@@ -277,7 +277,7 @@ int check_pkg_full(alpm_pkg_t *pkg)
return 0;
}
while(alpm_pkg_mtree_next(pkg, mtree, &entry) == ARCHIVE_OK) {
while(alpm_pkg_mtree_next(pkg, mtree, &entry) == 0) {
struct stat st;
const char *path = archive_entry_pathname(entry);
char filepath[PATH_MAX];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment