summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/archive_write.c
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2004-11-05 05:26:30 +0000
committerkientzle <kientzle@FreeBSD.org>2004-11-05 05:26:30 +0000
commitfef2e8cee8e209e7511da1d45f988dd029197358 (patch)
treebbc8fe472af0e8dbd66e73826de4bcb674aab1ff /lib/libarchive/archive_write.c
parent0a60201e3c56d5679ba25dbcc969368ba3fb74ea (diff)
downloadFreeBSD-src-fef2e8cee8e209e7511da1d45f988dd029197358.zip
FreeBSD-src-fef2e8cee8e209e7511da1d45f988dd029197358.tar.gz
Clean up the error handling in the
write path. In particular, this should solve some problems people have seen with bsdtar not exiting on various write errors.
Diffstat (limited to 'lib/libarchive/archive_write.c')
-rw-r--r--lib/libarchive/archive_write.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libarchive/archive_write.c b/lib/libarchive/archive_write.c
index 40f660d..76b4288 100644
--- a/lib/libarchive/archive_write.c
+++ b/lib/libarchive/archive_write.c
@@ -215,9 +215,12 @@ archive_write_header(struct archive *a, struct archive_entry *entry)
/*
* Note that the compressor is responsible for blocking.
*/
+/* Should be "ssize_t", but that breaks the ABI. <sigh> */
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);
- return (a->format_write_data(a, buff, s));
+ ret = (a->format_write_data)(a, buff, s);
+ return (ret == ARCHIVE_OK ? (ssize_t)s : -1);
}
OpenPOWER on IntegriCloud