From: Joel Rosdahl Date: Sun, 9 May 2010 14:56:16 +0000 (+0200) Subject: Check error from gzread when copying file X-Git-Tag: v3.0pre1~20 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=89fe28488e30657591386c63f906ffdece4b9e02;p=thirdparty%2Fccache.git Check error from gzread when copying file --- diff --git a/util.c b/util.c index 030deee98..f62aec004 100644 --- a/util.c +++ b/util.c @@ -190,6 +190,19 @@ int copy_file(const char *src, const char *dest, int compress_dest) return -1; } } + if (n == 0 && !gzeof(gz_in)) { + int errnum; + cc_log("gzread error: %s (errno: %s)", + gzerror(gz_in, &errnum), strerror(errno)); + gzclose(gz_in); + if (gz_out) { + gzclose(gz_out); + } + close(fd_out); + unlink(tmp_name); + free(tmp_name); + return -1; + } gzclose(gz_in); if (gz_out) {