From: Ed Maste Date: Fri, 29 Mar 2024 22:02:06 +0000 (-0400) Subject: tar: make error reporting more robust and use correct errno (#2101) X-Git-Tag: v3.7.3~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6110e9c82d8ba830c3440f36b990483ceaaea52c;p=thirdparty%2Flibarchive.git tar: make error reporting more robust and use correct errno (#2101) As discussed in #1609. --- diff --git a/tar/read.c b/tar/read.c index af3d3f423..a7f14a07b 100644 --- a/tar/read.c +++ b/tar/read.c @@ -371,8 +371,9 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) if (r != ARCHIVE_OK) { if (!bsdtar->verbose) safe_fprintf(stderr, "%s", archive_entry_pathname(entry)); - fprintf(stderr, ": %s: ", archive_error_string(a)); - fprintf(stderr, "%s", strerror(errno)); + safe_fprintf(stderr, ": %s: %s", + archive_error_string(a), + strerror(archive_errno(a))); if (!bsdtar->verbose) fprintf(stderr, "\n"); bsdtar->return_value = 1;