Correctly report write errors from the lowest-level

output routines back to the compression layer.
This commit is contained in:
kientzle 2004-10-17 23:47:30 +00:00
parent 2f1227d293
commit 28af6eb5e1
3 changed files with 21 additions and 6 deletions

View File

@ -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

View File

@ -135,10 +135,15 @@ static ssize_t
file_write(struct archive *a, void *client_data, void *buff, size_t length)
{
struct write_file_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

View File

@ -135,10 +135,15 @@ static ssize_t
file_write(struct archive *a, void *client_data, void *buff, size_t length)
{
struct write_file_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