diff options
author | kientzle <kientzle@FreeBSD.org> | 2004-11-05 05:39:37 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2004-11-05 05:39:37 +0000 |
commit | ac9cf04ce1ebcedbdfb9943c73b99b2daf980402 (patch) | |
tree | 9240c4351897a9500829200aedce1e0eb3552d07 /usr.bin/tar | |
parent | 6f08a572ae4e5cf1d5252e6ab67eecb0d2683187 (diff) | |
download | FreeBSD-src-ac9cf04ce1ebcedbdfb9943c73b99b2daf980402.zip FreeBSD-src-ac9cf04ce1ebcedbdfb9943c73b99b2daf980402.tar.gz |
Correct error handling on failed writes
to the archive.
Diffstat (limited to 'usr.bin/tar')
-rw-r--r-- | usr.bin/tar/Makefile | 2 | ||||
-rw-r--r-- | usr.bin/tar/write.c | 6 |
2 files changed, 3 insertions, 5 deletions
diff --git a/usr.bin/tar/Makefile b/usr.bin/tar/Makefile index 21f9f2e..f5b86fb 100644 --- a/usr.bin/tar/Makefile +++ b/usr.bin/tar/Makefile @@ -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} diff --git a/usr.bin/tar/write.c b/usr.bin/tar/write.c index e1e0a23..a9dec72 100644 --- a/usr.bin/tar/write.c +++ b/usr.bin/tar/write.c @@ -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; |