summaryrefslogtreecommitdiffstats
path: root/src/ustar.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ustar.c')
-rw-r--r--src/ustar.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/ustar.c b/src/ustar.c
index c759781..1bc8261 100644
--- a/src/ustar.c
+++ b/src/ustar.c
@@ -85,6 +85,13 @@ _opkg_opk_ustar_next(struct opkg_opk_ustar *ustar)
size_t i;
char *header_uc;
+ /* Seek through data records until next header record. */
+ while (ustar->data_size_remaining > 0) {
+ if (opkg_opk_ustar_read(ustar, NULL, NULL) == OPKG_OPK_ERROR) {
+ return OPKG_OPK_ERROR;
+ }
+ }
+
/* Decompress next (hopefully valid header) record. */
switch (opkg_opk_gzip_read(ustar->gzip, &ustar->header)) {
case OPKG_OPK_OK:
@@ -225,14 +232,6 @@ opkg_opk_ustar_list(struct opkg_opk_ustar *ustar,
strcpy((*member)->uname, ustar->header.uname);
strcpy((*member)->gname, ustar->header.gname);
- /* Seek through data records until next header record. */
- while (ustar->data_size_remaining > 0) {
- if (opkg_opk_ustar_read(ustar, NULL, NULL) == OPKG_OPK_ERROR) {
- free(*member);
- return OPKG_OPK_ERROR;
- }
- }
-
return OPKG_OPK_OK; /* Possibly more members in archive */
}
@@ -326,14 +325,6 @@ opkg_opk_ustar_seek(struct opkg_opk_ustar *ustar,
}
return OPKG_OPK_OK; /* Member found, but more remain */
}
-
- /* Seek through data records until next header record. */
- while (ustar->data_size_remaining > 0) {
- if (opkg_opk_ustar_read(ustar, NULL, NULL) ==
- OPKG_OPK_ERROR) {
- return OPKG_OPK_ERROR;
- }
- }
}
return OPKG_OPK_ERROR; /* Member not found */