summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/archive_write.c
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2006-11-15 05:14:20 +0000
committerkientzle <kientzle@FreeBSD.org>2006-11-15 05:14:20 +0000
commit8c58f2d4e886683f06f5018c49ab1c29b9a64302 (patch)
tree26d9c2a2e2f3ef0e43a46c1ba47b7fb7dad859f4 /lib/libarchive/archive_write.c
parent0cea6ebe6fec73e12ddd70734e98196884ed7fa9 (diff)
downloadFreeBSD-src-8c58f2d4e886683f06f5018c49ab1c29b9a64302.zip
FreeBSD-src-8c58f2d4e886683f06f5018c49ab1c29b9a64302.tar.gz
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
Diffstat (limited to 'lib/libarchive/archive_write.c')
-rw-r--r--lib/libarchive/archive_write.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/libarchive/archive_write.c b/lib/libarchive/archive_write.c
index 148f6b5..aa50c70 100644
--- a/lib/libarchive/archive_write.c
+++ b/lib/libarchive/archive_write.c
@@ -271,9 +271,7 @@ archive_write_header(struct archive *a, struct archive_entry *entry)
int
archive_write_data(struct archive *a, const void *buff, size_t s)
{
- int ret;
__archive_check_magic(a, ARCHIVE_WRITE_MAGIC, ARCHIVE_STATE_DATA, "archive_write_data");
archive_string_empty(&a->error_string);
- ret = (a->format_write_data)(a, buff, s);
- return (ret == ARCHIVE_OK ? (ssize_t)s : -1);
+ return ((a->format_write_data)(a, buff, s));
}
OpenPOWER on IntegriCloud