[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-tar] tar creates invalid archives when files shrink during read
From: |
Sergey Poznyakoff |
Subject: |
Re: [Bug-tar] tar creates invalid archives when files shrink during reading |
Date: |
Tue, 10 May 2005 17:27:13 +0300 |
Frank Heckenbach <address@hidden> wrote:
> The following patch seems to fix the problem since `bufsize', not
> `count' is used in the following `set_next_block_after' call.
Not quite so. The correct way would be:
Index: src/create.c
===================================================================
RCS file: /cvsroot/tar/tar/src/create.c,v
retrieving revision 1.94
diff -p -u -r1.94 create.c
--- src/create.c 7 Apr 2005 17:27:07 -0000 1.94
+++ src/create.c 10 May 2005 14:24:46 -0000
@@ -886,8 +886,6 @@ dump_regular_file (int fd, struct tar_st
}
size_left -= count;
- set_next_block_after (blk + (bufsize - 1) / BLOCKSIZE);
-
if (count != bufsize)
{
char buf[UINTMAX_STRSIZE_BOUND];
@@ -903,6 +901,8 @@ dump_regular_file (int fd, struct tar_st
pad_archive (size_left);
return dump_status_short;
}
+
+ set_next_block_after (blk + (bufsize - 1) / BLOCKSIZE);
}
return dump_status_ok;
}
Thanks for spotting the bug.
Regards,
Sergey