Skip to content

Commit

Permalink
sha1_file.c (write_sha1_file): Detect close failure
Browse files Browse the repository at this point in the history
This is in the same spirit as earlier fix to write_sha1_from_fd().

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Mar 27, 2007
1 parent b704e58 commit e82973c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sha1_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e82973c

Please sign in to comment.