From 652b5a0bb66c90b8235cca1ef67e84a55a83d90a Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Mon, 17 Apr 2023 10:32:47 -0400 Subject: main: Improve error messages about inner archive --- diff --git a/src/main.c b/src/main.c index f713645..14c586f 100644 --- a/src/main.c +++ b/src/main.c @@ -97,8 +97,6 @@ _opkg_opk_main_extract(const char *file_name, const char *outer_member, } if (inner_action(inner_ustar) != OPKG_OPK_OK) { - fprintf(stderr, "Error: Failed to read \"%s\" in archive\n", - outer_member); goto error5; } @@ -130,12 +128,16 @@ _opkg_opk_main_read_control(struct opkg_opk_ustar *ustar) size_t size; int ret; - opkg_opk_ustar_seek(ustar, "control"); + if (opkg_opk_ustar_seek(ustar, "control") != OPKG_OPK_OK) { + fputs("Error: Failed to find control file\n", stderr); + return OPKG_OPK_ERROR; + } while ((ret = opkg_opk_ustar_read(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; } @@ -152,6 +154,7 @@ _opkg_opk_main_list_members(struct opkg_opk_ustar *ustar) puts(member.name); } if (ret == OPKG_OPK_ERROR) { + fputs("Error: Failed to list data files\n", stderr); return OPKG_OPK_ERROR; } -- cgit v0.9.1