Record an error message if there are write errors when extracting the

content of an archive entry to a file descriptor.
This commit is contained in:
Tim Kientzle 2005-08-10 15:02:53 +00:00
parent 4b9adc2fef
commit 44938dbf6d

View File

@ -28,6 +28,7 @@
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
#include "archive.h"
@ -65,8 +66,10 @@ archive_read_data_into_fd(struct archive *a, int fd)
if (bytes_to_write > MAX_WRITE)
bytes_to_write = MAX_WRITE;
bytes_written = write(fd, buff, bytes_to_write);
if (bytes_written < 0)
if (bytes_written < 0) {
archive_set_error(a, errno, "Write error");
return (-1);
}
output_offset += bytes_written;
total_written += bytes_written;
size -= bytes_written;