aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@FreeBSD.org>2004-04-26 23:39:17 +0000
committerTim Kientzle <kientzle@FreeBSD.org>2004-04-26 23:39:17 +0000
commit749029a4376bf66022804344d57197d3d2f6e097 (patch)
treefed55e7d81273767c7fd65b66908b0ecb89e8f99 /usr.bin
parent61fac2242c77a75b588a0a6f71b0f75c5d4d1fdc (diff)
Notes
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tar/write.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/usr.bin/tar/write.c b/usr.bin/tar/write.c
index 2d097fae7e460..dace199dd44ec 100644
--- a/usr.bin/tar/write.c
+++ b/usr.bin/tar/write.c
@@ -117,7 +117,8 @@ static void write_archive(struct archive *, struct bsdtar *);
static void write_entry(struct bsdtar *, struct archive *,
struct stat *, const char *pathname,
unsigned pathlen, const char *accpath);
-static int write_file_data(struct archive *, int fd);
+static int write_file_data(struct bsdtar *, struct archive *,
+ int fd);
static void write_heirarchy(struct bsdtar *, struct archive *,
const char *);
@@ -727,10 +728,8 @@ write_entry(struct bsdtar *bsdtar, struct archive *a, struct stat *st,
archive_entry_set_gname(entry, lookup_gname(bsdtar, st->st_gid));
#ifdef HAVE_CHFLAGS
- if (st->st_flags != 0) {
- fflags = fflagstostr(st->st_flags);
- archive_entry_set_fflags(entry, fflags);
- }
+ if (st->st_flags != 0)
+ archive_entry_set_fflags(entry, st->st_flags, 0);
#endif
archive_entry_copy_stat(entry, st);
@@ -772,7 +771,7 @@ write_entry(struct bsdtar *bsdtar, struct archive *a, struct stat *st,
* that case, just skip the write.
*/
if (fd >= 0 && archive_entry_size(entry) > 0)
- write_file_data(a, fd);
+ write_file_data(bsdtar, a, fd);
cleanup:
if (fd >= 0)
@@ -790,12 +789,16 @@ cleanup:
/* Helper function to copy file to archive, with stack-allocated buffer. */
static int
-write_file_data(struct archive *a, int fd)
+write_file_data(struct bsdtar *bsdtar, struct archive *a, int fd)
{
- char buff[8192];
+ char buff[64*1024];
ssize_t bytes_read;
ssize_t bytes_written;
+ /* XXX TODO: Allocate buffer on heap and store pointer to
+ * it in bsdtar structure; arrange cleanup as well. XXX */
+ (void)bsdtar;
+
bytes_read = read(fd, buff, sizeof(buff));
while (bytes_read > 0) {
bytes_written = archive_write_data(a, buff, bytes_read);