aboutsummaryrefslogtreecommitdiff
path: root/lib/libarchive/archive_write_set_format_pax.c
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@FreeBSD.org>2006-11-15 05:14:20 +0000
committerTim Kientzle <kientzle@FreeBSD.org>2006-11-15 05:14:20 +0000
commitca743d5c67f2e88ebff89f5f9eefef56e1da5a02 (patch)
tree26d9c2a2e2f3ef0e43a46c1ba47b7fb7dad859f4 /lib/libarchive/archive_write_set_format_pax.c
parente5cedd89dc22f3670bcd5d0edc219e48ec32c5ed (diff)
downloadsrc-ca743d5c67f2e88ebff89f5f9eefef56e1da5a02.tar.gz
src-ca743d5c67f2e88ebff89f5f9eefef56e1da5a02.zip
Change the internal API for writing data to an entry; make the
internal format-specific functions return the same as the public function, so that the public API layer doesn't have to guess the correct return value. This addresses an obscure problem that occurs when someone tries to write more data than the size of the entry (as indicated in the entry header). In this case, the return value from archive_write_data() was incorrect, reflecting the requested write rather than the amount actually written. MFC after: 15 days
Notes
Notes: svn path=/head/; revision=164290
Diffstat (limited to 'lib/libarchive/archive_write_set_format_pax.c')
-rw-r--r--lib/libarchive/archive_write_set_format_pax.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/libarchive/archive_write_set_format_pax.c b/lib/libarchive/archive_write_set_format_pax.c
index 81a43b750496..657a72089862 100644
--- a/lib/libarchive/archive_write_set_format_pax.c
+++ b/lib/libarchive/archive_write_set_format_pax.c
@@ -70,7 +70,7 @@ static void add_pax_attr_time(struct archive_string *,
unsigned long nanos);
static void add_pax_attr_w(struct archive_string *,
const char *key, const wchar_t *wvalue);
-static int archive_write_pax_data(struct archive *,
+static ssize_t archive_write_pax_data(struct archive *,
const void *, size_t);
static int archive_write_pax_finish(struct archive *);
static int archive_write_pax_finish_entry(struct archive *);
@@ -1081,7 +1081,7 @@ write_nulls(struct archive *a, size_t padding)
return (ARCHIVE_OK);
}
-static int
+static ssize_t
archive_write_pax_data(struct archive *a, const void *buff, size_t s)
{
struct pax *pax;
@@ -1094,7 +1094,10 @@ archive_write_pax_data(struct archive *a, const void *buff, size_t s)
ret = (a->compression_write)(a, buff, s);
pax->entry_bytes_remaining -= s;
- return (ret);
+ if (ret == ARCHIVE_OK)
+ return (s);
+ else
+ return (ret);
}
static int