Correct error handling on failed writes
to the archive.
This commit is contained in:
parent
b772d06c77
commit
f52188fc8a
@ -6,7 +6,7 @@
|
||||
#
|
||||
|
||||
PROG= bsdtar
|
||||
VERSION= 1.01.011
|
||||
VERSION= 1.01.015
|
||||
SRCS= bsdtar.c matching.c read.c util.c write.c
|
||||
WARNS?= 6
|
||||
DPADD= ${LIBARCHIVE} ${LIBBZ2} ${LIBZ}
|
||||
|
@ -875,10 +875,8 @@ write_file_data(struct bsdtar *bsdtar, struct archive *a, int fd)
|
||||
bytes_read = read(fd, buff, sizeof(buff));
|
||||
while (bytes_read > 0) {
|
||||
bytes_written = archive_write_data(a, buff, bytes_read);
|
||||
|
||||
if (bytes_written == 0 && errno) {
|
||||
return -1; /* Write failed; this is bad */
|
||||
}
|
||||
if (bytes_written <= 0)
|
||||
return (-1); /* Write failed; this is bad */
|
||||
bytes_read = read(fd, buff, sizeof(buff));
|
||||
}
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user