diff options
Diffstat (limited to 'src/opk.c')
-rw-r--r-- | src/opk.c | 36 |
1 files changed, 21 insertions, 15 deletions
@@ -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; } |