From: Junio C Hamano Date: Tue, 27 Mar 2007 19:55:44 +0000 (-0700) Subject: sha1_file.c (write_sha1_file): Detect close failure X-Git-Tag: v1.5.1-rc3~16 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e82973cfb046b4298114368e6d194a3418f2a30c;p=git.git sha1_file.c (write_sha1_file): Detect close failure This is in the same spirit as earlier fix to write_sha1_from_fd(). Signed-off-by: Junio C Hamano --- diff --git a/sha1_file.c b/sha1_file.c index 42aef331f..9c2603842 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -2020,7 +2020,8 @@ int write_sha1_file(void *buf, unsigned long len, const char *type, unsigned cha if (write_buffer(fd, compressed, size) < 0) die("unable to write sha1 file"); fchmod(fd, 0444); - close(fd); + if (close(fd)) + die("unable to write sha1 file"); free(compressed); return move_temp_to_file(tmpfile, filename);