Skip to content

Commit

Permalink
contrib/archivetest: report archive_error_string() on error
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatuska committed May 20, 2019
1 parent 43ce557 commit b5818e3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions contrib/archivetest.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,18 +197,22 @@ int main(int argc, char *argv[])
while ((r = archive_read_data(a, buffer, 4096) > 0))
;
if (r == ARCHIVE_FATAL) {
v_print(v, "ERROR\n");
v_print(v, "ERROR\nError string: %s\n",
archive_error_string(a));
break;
}
v_print(v, "OK");
}
v_print(v, "\n");
c++;
}
archive_read_free(a);

v_print(v, "Last return code: %s (%d)\n", errnostr(r), r);
if (r == ARCHIVE_EOF || r == ARCHIVE_OK)
if (r == ARCHIVE_EOF || r == ARCHIVE_OK) {
archive_read_free(a);
exit(0);
}
v_print(v, "Error string: %s\n", archive_error_string(a));
archive_read_free(a);
exit(2);
}

0 comments on commit b5818e3

Please sign in to comment.