Code

sha1_file.c (write_sha1_from_fd): Detect close failure.
[git.git] / sha1_file.c
index 0897b945e5dace8189adc35e6eea389cfc7606af..42aef331f2e028d625dd2f6354cda2dfd55e71e0 100644 (file)
@@ -2155,7 +2155,8 @@ int write_sha1_from_fd(const unsigned char *sha1, int fd, char *buffer,
        inflateEnd(&stream);
 
        fchmod(local, 0444);
-       close(local);
+       if (close(local) != 0)
+               die("unable to write sha1 file");
        SHA1_Final(real_sha1, &c);
        if (ret != Z_STREAM_END) {
                unlink(tmpfile);