>From 05dd32756c98df54c1a5169f8039dcafcfb45eac Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Mon, 17 Nov 2014 13:13:15 +0100 Subject: [PATCH 1/2] Fix unaligned archive corruption with --append If a archive size is not a factor of --block-size, do not backspace the archive of whole record_size. * src/buffer.c (backspace_output): Seek back only to beginning of the current record. --- src/buffer.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/buffer.c b/src/buffer.c index a7d8971..5dd48f7 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1031,7 +1031,13 @@ backspace_output (void) /* Seek back to the beginning of this record and start writing there. */ - position -= record_size; + off_t bs = position % record_size; + + if (!bs) + bs = record_size; + + position -= bs; + if (position < 0) position = 0; if (rmtlseek (archive, position, SEEK_SET) != position) -- 1.9.3