Skip to content

Commit

Permalink
tar: make error reporting more robust and use correct errno
Browse files Browse the repository at this point in the history
As discussed in libarchive#1609.
  • Loading branch information
emaste committed Mar 29, 2024
1 parent 2fb7b0c commit e200fd8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tar/read.c
Expand Up @@ -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;
Expand Down

0 comments on commit e200fd8

Please sign in to comment.