From 29c902bc4949f6020df6470aa1115ce15dab802a Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Thu, 12 May 2005 15:39:21 +0000 Subject: [PATCH] (dump_regular_file): Correctly pad archive members that shrunk during archiving. Repored by Frank Heckenbach. --- src/create.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/create.c b/src/create.c index d8f0c76..3760ef6 100644 --- a/src/create.c +++ b/src/create.c @@ -886,9 +886,9 @@ dump_regular_file (int fd, struct tar_stat_info *st) return dump_status_short; } size_left -= count; - - set_next_block_after (blk + (bufsize - 1) / BLOCKSIZE); - + if (count) + set_next_block_after (blk + (bufsize - 1) / BLOCKSIZE); + if (count != bufsize) { char buf[UINTMAX_STRSIZE_BOUND]; @@ -901,7 +901,7 @@ dump_regular_file (int fd, struct tar_stat_info *st) STRINGIFY_BIGINT (size_left, buf))); if (! ignore_failed_read_option) exit_status = TAREXIT_FAILURE; - pad_archive (size_left); + pad_archive (size_left - (bufsize-count)); return dump_status_short; } } -- 2.44.0