diff options
Diffstat (limited to 'usr.bin/tar/write.c')
-rw-r--r-- | usr.bin/tar/write.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.bin/tar/write.c b/usr.bin/tar/write.c index 207122e..e59f647 100644 --- a/usr.bin/tar/write.c +++ b/usr.bin/tar/write.c @@ -965,15 +965,21 @@ report_write(struct bsdtar *bsdtar, struct archive *a, struct archive_entry *entry, int64_t progress) { uint64_t comp, uncomp; + int compression; + if (bsdtar->verbose) fprintf(stderr, "\n"); comp = archive_position_compressed(a); uncomp = archive_position_uncompressed(a); fprintf(stderr, "In: %d files, %s bytes;", archive_file_count(a), tar_i64toa(uncomp)); + if (comp > uncomp) + compression = 0; + else + compression = (int)((uncomp - comp) * 100 / uncomp); fprintf(stderr, " Out: %s bytes, compression %d%%\n", - tar_i64toa(comp), (int)((uncomp - comp) * 100 / uncomp)); + tar_i64toa(comp), compression); /* Can't have two calls to tar_i64toa() pending, so split the output. */ safe_fprintf(stderr, "Current: %s (%s", archive_entry_pathname(entry), |