index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Allan McRae <allan@archlinux.org> | 2019-11-26 11:37:32 +1000 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2019-11-26 11:37:32 +1000 |
commit | 1e23b4585146b5c2bced10293c0f3486e53d51ed (patch) | |
tree | 7511ff0dfe9f4cd6b6b60cbb05503ac9be4fdd3d | |
parent | 3073752bcd9718b243661dd727e8f8bc18035938 (diff) |
-rw-r--r-- | lib/libalpm/alpm.h | 2 | ||||
-rw-r--r-- | lib/libalpm/be_local.c | 18 | ||||
-rw-r--r-- | src/pacman/check.c | 2 |
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index c200a5d8..956284bd 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -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); diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index 5d4a7508..b89acf05 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -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; } /** diff --git a/src/pacman/check.c b/src/pacman/check.c index ab35891a..85b25f39 100644 --- a/src/pacman/check.c +++ b/src/pacman/check.c @@ -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]; |