]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Check error from gzread when copying file
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 9 May 2010 14:56:16 +0000 (16:56 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 9 May 2010 14:59:08 +0000 (16:59 +0200)
util.c

diff --git a/util.c b/util.c
index 030deee980e790848af81ab81b5de71370948fcd..f62aec004c64335a7156c303c9c90e02ef314709 100644 (file)
--- 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) {