diff options
author | kientzle <kientzle@FreeBSD.org> | 2004-11-05 05:26:30 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2004-11-05 05:26:30 +0000 |
commit | fef2e8cee8e209e7511da1d45f988dd029197358 (patch) | |
tree | bbc8fe472af0e8dbd66e73826de4bcb674aab1ff /lib/libarchive/archive_write.c | |
parent | 0a60201e3c56d5679ba25dbcc969368ba3fb74ea (diff) | |
download | FreeBSD-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.c | 5 |
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); } |