summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2008-06-25 05:01:02 +0000
committerkientzle <kientzle@FreeBSD.org>2008-06-25 05:01:02 +0000
commit97d3a2b6f0f78f5ce376e7e5daad0bda02a5caf3 (patch)
treee1a2165c5833d7b0d98adbe12a0fc3da877132c8 /usr.bin
parent0ed5f14f61dbb2462b727477fb3548a9abc0982f (diff)
downloadFreeBSD-src-97d3a2b6f0f78f5ce376e7e5daad0bda02a5caf3.zip
FreeBSD-src-97d3a2b6f0f78f5ce376e7e5daad0bda02a5caf3.tar.gz
Pass the entry down into the core write loop, so we
can include the filename when reporting errors. Thanks to: Dan Nelson
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tar/write.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/tar/write.c b/usr.bin/tar/write.c
index f2ff46a..5438253 100644
--- a/usr.bin/tar/write.c
+++ b/usr.bin/tar/write.c
@@ -142,7 +142,7 @@ static void write_entry(struct bsdtar *, struct archive *,
static void write_entry_backend(struct bsdtar *, struct archive *,
struct archive_entry *, int);
static int write_file_data(struct bsdtar *, struct archive *,
- int fd);
+ struct archive_entry *, int fd);
static void write_hierarchy(struct bsdtar *, struct archive *,
const char *);
@@ -838,7 +838,7 @@ write_entry_backend(struct bsdtar *bsdtar, struct archive *a,
* that case, just skip the write.
*/
if (e >= ARCHIVE_WARN && fd >= 0 && archive_entry_size(entry) > 0) {
- if (write_file_data(bsdtar, a, fd))
+ if (write_file_data(bsdtar, a, entry, fd))
exit(1);
close(fd);
}
@@ -959,7 +959,8 @@ abort:
/* Helper function to copy file to archive, with stack-allocated buffer. */
static int
-write_file_data(struct bsdtar *bsdtar, struct archive *a, int fd)
+write_file_data(struct bsdtar *bsdtar, struct archive *a,
+ struct archive_entry *entry, int fd)
{
char buff[64*1024];
ssize_t bytes_read;
@@ -982,7 +983,8 @@ write_file_data(struct bsdtar *bsdtar, struct archive *a, int fd)
if (bytes_written < bytes_read) {
/* Write was truncated; warn but continue. */
bsdtar_warnc(bsdtar, 0,
- "Truncated write; file may have grown while being archived.");
+ "%s: Truncated write; file may have grown while being archived.",
+ archive_entry_pathname(entry));
return (0);
}
progress += bytes_written;
OpenPOWER on IntegriCloud