@matheusbsbs / matheus-bagliano / commits / e82973cfb0
Fork 0

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 <junkio@cox.net>

Junio C Hamano committed Mar 27, 2007 at 12:55 UTC e82973cfb046b4298114368e6d194a3418f2a30c
1 file changed +2 -1
sha1_file.c
+2 -1
@@ -2020,7 +2020,8 @@ int write_sha1_file(void *buf, unsigned long len, const char *type, unsigned cha
2020 if (write_buffer(fd, compressed, size) < 0)
2021 die("unable to write sha1 file");
2022 fchmod(fd, 0444);
2023 - close(fd);
2023 + if (close(fd))
2024 + die("unable to write sha1 file");
2025 free(compressed);
2026
2027 return move_temp_to_file(tmpfile, filename);