summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c5
-rw-r--r--src/opk.c36
2 files changed, 26 insertions, 15 deletions
diff --git a/src/main.c b/src/main.c
index b24a2fd..fdfc290 100644
--- a/src/main.c
+++ b/src/main.c
@@ -35,6 +35,11 @@ main(int argc, char *argv[])
"control") != OPKG_OPK_OK) {
goto error0;
}
+ if (opkg_opk_ustar_add_seek_name(
+ &control_files_head, &control_files_tail,
+ "md5sums") != OPKG_OPK_OK) {
+ goto error0;
+ }
/* Initialize outer archive. */
opk = opkg_opk_opk_init_outer(argv[1]);
diff --git a/src/opk.c b/src/opk.c
index 82aaca3..cd92bd6 100644
--- a/src/opk.c
+++ b/src/opk.c
@@ -176,26 +176,32 @@ opkg_opk_opk_read_control(struct opkg_opk_opk *opk,
{
char *buffer;
size_t size;
- int ret;
+ int ret_seek;
+ int ret_read;
- if (opk->previously_printed == 1) {
- puts("");
+ while ((ret_seek = opkg_opk_ustar_seek(opk->inner_ustar, names)) !=
+ OPKG_OPK_ERROR) {
+ if (opk->previously_printed == 1) {
+ puts("");
+ }
+ while ((ret_read = opkg_opk_ustar_read(opk->inner_ustar,
+ &buffer, &size)) == OPKG_OPK_OK)
+ {
+ fwrite(buffer, 1, size, stdout);
+ }
+ if (ret_read == OPKG_OPK_ERROR) {
+ fputs("Error: Failed to read control file\n", stderr);
+ return OPKG_OPK_ERROR;
+ }
+ opk->previously_printed = 1;
+ if (ret_seek == OPKG_OPK_END) {
+ break;
+ }
}
-
- if (opkg_opk_ustar_seek(opk->inner_ustar, names) == OPKG_OPK_ERROR) {
+ if (ret_seek == OPKG_OPK_ERROR) {
fputs("Error: Failed to find control file\n", stderr);
return OPKG_OPK_ERROR;
}
- while ((ret = opkg_opk_ustar_read(opk->inner_ustar, &buffer, &size)) ==
- OPKG_OPK_OK) {
- fwrite(buffer, 1, size, stdout);
- }
- if (ret == OPKG_OPK_ERROR) {
- fputs("Error: Failed to read control file\n", stderr);
- return OPKG_OPK_ERROR;
- }
-
- opk->previously_printed = 1;
return OPKG_OPK_OK;
}