Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/be_local.c
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2019-11-26 11:37:32 +1000
committerAllan McRae <allan@archlinux.org>2019-11-26 11:37:32 +1000
commit1e23b4585146b5c2bced10293c0f3486e53d51ed (patch)
tree7511ff0dfe9f4cd6b6b60cbb05503ac9be4fdd3d /lib/libalpm/be_local.c
parent3073752bcd9718b243661dd727e8f8bc18035938 (diff)
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: morganamilo <morganamilo@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/be_local.c')
-rw-r--r--lib/libalpm/be_local.c18
1 files changed, 16 insertions, 2 deletions
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;
}
/**