eal/unix: enhance error reporting for firmware
PATCH 1/1 eal/unix: enhance error reporting for firmware
Put more details if a libarchive context initialisation fails.
Signed-off-by David Marchand <[email protected]>
--- lib/eal/unix/eal_firmware.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-)
lib/eal/unix/eal_firmware.c +30 -7
@@ -25,19 +25,42 @@ static int firmware_open(struct firmware_read_ctx *ctx, const char *name, size_t blocksize) { struct archive_entry *e; +int err; ctx->a =archive_read_new ();if (ctx->a ==NULL )return -1 ; -if (archive_read_support_format_raw (ctx->a) !=ARCHIVE_OK || -archive_read_support_filter_xz (ctx->a) !=ARCHIVE_OK || -archive_read_open_filename (ctx->a, name, blocksize) !=ARCHIVE_OK || -archive_read_next_header (ctx->a, &e) !=ARCHIVE_OK ) { -archive_read_free (ctx->a); - ctx->a =NULL ; -return -1 ; + err =archive_read_support_format_raw (ctx->a); +if (err !=ARCHIVE_OK ) { +RTE_LOG (ERR ,EAL ,"archive_read_support_format_raw() failed with %d: %s\n" , + err,archive_error_string (ctx->a)); + goto err; + } + err =archive_read_support_filter_xz (ctx->a); +if (err !=ARCHIVE_OK ) { +RTE_LOG (ERR ,EAL ,"archive_read_support_filter_xz() failed with %d: %s\n" , + err,archive_error_string (ctx->a)); + goto err; + } + err =archive_read_open_filename (ctx->a, name, blocksize); +if (err !=ARCHIVE_OK ) { +RTE_LOG (ERR ,EAL ,"archive_read_open_filename() failed with %d: %s\n" , + err,archive_error_string (ctx->a)); + goto err; + } + err =archive_read_next_header (ctx->a, &e); +if (err !=ARCHIVE_OK ) { +RTE_LOG (ERR ,EAL ,"archive_read_next_header() failed with %d: %s\n" , + err,archive_error_string (ctx->a)); + goto err; } +return 0 ; + +err: +archive_read_free (ctx->a); + ctx->a =NULL ; +return -1 ; } static ssize_t
Signature · 1 line
2.41.0
Quoted 4 lines · David Marchand
Put more details if a libarchive context initialisation fails.
Signed-off-by David Marchand <[email protected]>
Now that the original reported issue has been understood, I don't think we need this patch.
I'll discard it in patchwork.
Signature · 1 line
David Marchand