diff options
author | Martin Matuska <martin@matuska.org> | 2019-05-20 13:24:59 +0200 |
---|---|---|
committer | Martin Matuska <martin@matuska.org> | 2019-05-20 13:24:59 +0200 |
commit | b5818e39e128eca4951e2ab10467d4d850a2ba57 (patch) | |
tree | 6bc2f083bdee3f2071d5bdf7f8f3898e2f11db58 /contrib | |
parent | 43ce557e66fd192afb7c3dc4421cb11e643b15d5 (diff) | |
download | libarchive-b5818e39e128eca4951e2ab10467d4d850a2ba57.tar.gz |
contrib/archivetest: report archive_error_string() on error
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/archivetest.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/contrib/archivetest.c b/contrib/archivetest.c index f4a469b4..8002039e 100644 --- a/contrib/archivetest.c +++ b/contrib/archivetest.c @@ -197,7 +197,8 @@ 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"); @@ -205,10 +206,13 @@ int main(int argc, char *argv[]) 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); } |