Be certain to not abort prematurely when reading stuff from pipes.
authorEric Andersen <andersen@codepoet.org>
Sat, 5 Jul 2003 23:10:27 +0000 (23:10 -0000)
committerEric Andersen <andersen@codepoet.org>
Sat, 5 Jul 2003 23:10:27 +0000 (23:10 -0000)
archival/libunarchive/archive_xread.c
archival/libunarchive/init_handle.c
archival/tar.c

index 0b29dbfb913503156c2d57c3ce662441e67585d3..d63d0d5a2cf08a6e5c6060e8e5ba716f13b6ac6a 100644 (file)
@@ -25,7 +25,7 @@ extern ssize_t archive_xread(const archive_handle_t *archive_handle, unsigned ch
        ssize_t size;
 
        size = archive_handle->read(archive_handle->src_fd, buf, count);
-       if (size == -1) {
+       if (size < 0) {
                bb_perror_msg_and_die("Read error");
        }
 
index 4b0103491ab5304e854d1d996ca82467576b0cd5..2659aa3ebcb2cec8dc95e5151dfe2bd3d76065f2 100644 (file)
@@ -30,7 +30,7 @@ archive_handle_t *init_handle(void)
        archive_handle->action_header = header_skip;
        archive_handle->action_data = data_skip;
        archive_handle->filter = filter_accept_all;
-       archive_handle->read = read;
+       archive_handle->read = bb_full_read;
        archive_handle->seek = seek_by_jump;
 
        return(archive_handle);
index b6c2ef91e20f720a10cd4167983450c8a1cbc529..93d5fbd453c2723a31fc6dac55565caeb61f2bd0 100644 (file)
@@ -526,7 +526,7 @@ static inline int writeTarFile(const char *tarName, const int verboseFlag,
                        while (1) {
                                char buf;
 
-                               int n = read(gzipStatusPipe[0], &buf, 1);
+                               int n = bb_full_read(gzipStatusPipe[0], &buf, 1);
 
                                if (n == 0 && vfork_exec_errno != 0) {
                                        errno = vfork_exec_errno;