Instead of using the error handling code, failed reads are being treated as end of file. This applies only when using zlib and libbz2. In practice it probably has not caused problems because I/O errors are rare and often the program at the other end of the pipe can notice the pipe unexpectedly closing.
Signed-off-by: Jonathan Nieder <[email protected]> --- Hi, This is the first of five patches fixing issues I noticed while looking over the previous ones. In the next round, these should go earlier in the series, probably after patch #4, but for now it seems simplest to send them based on top of the rest of the patches. The other four have the following titles: libdpkg: compression: do not handle EINTR libdpkg: check for write errors during decompression libdpkg: fix misspelling of __attribute__((const)) libdpkg: compression: check for output errors closing files All have to do with error handling. The current error handling code here didn't make much sense to me, so I tried to fix those problems I could find. lib/dpkg/compression-backend.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/dpkg/compression-backend.c b/lib/dpkg/compression-backend.c index 5ece2a4..551a54a 100644 --- a/lib/dpkg/compression-backend.c +++ b/lib/dpkg/compression-backend.c @@ -101,7 +101,7 @@ default_memlimit() int actualread; \ zFile zfile = zdopen(fd_in, "r"); \ \ - while ((actualread = zread(zfile, buffer, sizeof(buffer))) > 0) { \ + while ((actualread = zread(zfile, buffer, sizeof(buffer)))) { \ if (actualread < 0) { \ int err = 0; \ const char *errmsg = zerror(zfile, &err); \ @@ -128,7 +128,7 @@ default_memlimit() zFile zfile; \ \ zfile = zdopen(fd_out, combuf); \ - while ((actualread = read(fd_in, buffer, sizeof(buffer))) > 0) { \ + while ((actualread = read(fd_in, buffer, sizeof(buffer)))) { \ if (actualread < 0) { \ if (errno == EINTR) \ continue; \ -- 1.6.5.rc1.199.g596ec -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

