diff options
author | kientzle <kientzle@FreeBSD.org> | 2004-10-17 23:47:30 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2004-10-17 23:47:30 +0000 |
commit | 28af6eb5e1fe00d175f72dd8b6427ee50ecd9be4 (patch) | |
tree | 0b768b00cd950bf199f79233f829ac65eb6efdb2 /lib/libarchive/archive_write_open_fd.c | |
parent | 2f1227d293d3abebbf9fb61d07ab6ad5c410f952 (diff) | |
download | FreeBSD-src-28af6eb5e1fe00d175f72dd8b6427ee50ecd9be4.zip FreeBSD-src-28af6eb5e1fe00d175f72dd8b6427ee50ecd9be4.tar.gz |
Correctly report write errors from the lowest-level
output routines back to the compression layer.
Diffstat (limited to 'lib/libarchive/archive_write_open_fd.c')
-rw-r--r-- | lib/libarchive/archive_write_open_fd.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/libarchive/archive_write_open_fd.c b/lib/libarchive/archive_write_open_fd.c index ae8c2e2..58bfbd3 100644 --- a/lib/libarchive/archive_write_open_fd.c +++ b/lib/libarchive/archive_write_open_fd.c @@ -111,10 +111,15 @@ static ssize_t file_write(struct archive *a, void *client_data, void *buff, size_t length) { struct write_fd_data *mine; + ssize_t bytesWritten; - (void)a; /* UNUSED */ mine = client_data; - return (write(mine->fd, buff, length)); + bytesWritten = write(mine->fd, buff, length); + if (bytesWritten <= 0) { + archive_set_error(a, errno, "Write error"); + return (-1); + } + return (bytesWritten); } static int |