diff options
author | kientzle <kientzle@FreeBSD.org> | 2006-11-15 05:14:20 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2006-11-15 05:14:20 +0000 |
commit | 8c58f2d4e886683f06f5018c49ab1c29b9a64302 (patch) | |
tree | 26d9c2a2e2f3ef0e43a46c1ba47b7fb7dad859f4 /lib/libarchive/archive_write_set_format_pax.c | |
parent | 0cea6ebe6fec73e12ddd70734e98196884ed7fa9 (diff) | |
download | FreeBSD-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_set_format_pax.c')
-rw-r--r-- | lib/libarchive/archive_write_set_format_pax.c | 9 |
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 81a43b7..657a720 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 |