From b3ddcf966c9489c33edf03ff7a02b0de5faef4f0 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sat, 15 Apr 2023 19:58:41 -0400 Subject: main: Print error messages --- diff --git a/src/main.c b/src/main.c index 01f564b..f993b3b 100644 --- a/src/main.c +++ b/src/main.c @@ -59,20 +59,26 @@ _opkg_opk_main_extract(const char *file_name, const char *outer_member, file.file = fopen(file_name, "rb"); if (file.file == NULL) { + fprintf(stderr, "Error: Failed to open file \"%s\"\n", + file_name); goto error0; } outer_gzip = opkg_opk_gzip_init(&_opkg_opk_main_file_read, &file); if (outer_gzip == NULL) { + fputs("Error: Failed to initialize\n", stderr); goto error1; } outer_ustar = opkg_opk_ustar_init(outer_gzip); if (outer_ustar == NULL) { + fputs("Error: Failed to initialize\n", stderr); goto error2; } if (opkg_opk_ustar_seek(outer_ustar, outer_member) != OPKG_OPK_OK) { + fprintf(stderr, "Error: Failed to find \"%s\" in archive\n", + outer_member); goto error3; } @@ -80,15 +86,19 @@ _opkg_opk_main_extract(const char *file_name, const char *outer_member, (opkg_opk_gzip_read_func *) &opkg_opk_ustar_read, outer_ustar); if (inner_gzip == NULL) { + fputs("Error: Failed to initialize\n", stderr); goto error3; } inner_ustar = opkg_opk_ustar_init(inner_gzip); if (inner_ustar == NULL) { + fputs("Error: Failed to initialize\n", stderr); goto error4; } if (inner_action(inner_ustar) != OPKG_OPK_OK) { + fprintf(stderr, "Error: Failed to read \"%s\" in archive\n", + outer_member); goto error5; } -- cgit v0.9.1