When copying file data to the archive, don't write more

than was read.  This seems to have only affected the shar
writer, since other formats proactively truncate output
to the originally-advertised size.

PR:		bin/131244
MFC after:	7 days
This commit is contained in:
Tim Kientzle 2009-02-08 22:02:46 +00:00
parent ffc4f90610
commit ec9d8e0b01
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=188343

View File

@ -972,7 +972,7 @@ write_file_data(struct bsdtar *bsdtar, struct archive *a,
siginfo_printinfo(bsdtar, progress);
bytes_written = archive_write_data(a, bsdtar->buff,
FILEDATABUFLEN);
bytes_read);
if (bytes_written < 0) {
/* Write failed; this is bad */
bsdtar_warnc(bsdtar, 0, "%s", archive_error_string(a));