From ec9d8e0b011104bb8ce4ff1d08536f6bc61c64fe Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Sun, 8 Feb 2009 22:02:46 +0000 Subject: [PATCH] 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 --- usr.bin/tar/write.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/tar/write.c b/usr.bin/tar/write.c index 32df3a29871e..b14aad5c1985 100644 --- a/usr.bin/tar/write.c +++ b/usr.bin/tar/write.c @@ -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));