From: Rene Scharfe Date: Fri, 3 Jun 2005 11:25:18 +0000 (+0200) Subject: [PATCH] git-tar-tree: fix write_trailer X-Git-Tag: v0.99~377 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=a325a11b88bc13d569be1571ce559858dc224af4;p=git.git [PATCH] git-tar-tree: fix write_trailer write_trailer() writes the last 10k (a full block) of the tar archive. write_if_needed() writes out a block *if* it is full and then sets the offset to 0. In nine out of ten cases the messed up write_trailer() function didn't manage to fill the block thus not writing anything at all, truncating the archive. I was "lucky" to hit the other case and so my testing ran OK. Signed-off-by: Rene Scharfe Signed-off-by: Linus Torvalds --- diff --git a/tar-tree.c b/tar-tree.c index c2eb21c9..4c47fc2b 100644 --- a/tar-tree.c +++ b/tar-tree.c @@ -77,7 +77,7 @@ static void write_trailer(void) write_if_needed(); get_record(); write_if_needed(); - if (offset) { + while (offset) { get_record(); write_if_needed(); }