From 91c8d5905c33e9d7c9014a1c6c7cec8eb86584df Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 24 Jun 2007 21:20:41 +0200 Subject: detect close failure on just-written file handles I audited git for potential undetected write failures. In the cases fixed below, the diagnostics I add mimic the diagnostics used in surrounding code, even when that means not reporting the precise strerror(errno) cause of the error. Signed-off-by: Jim Meyering Signed-off-by: Junio C Hamano --- index-pack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'index-pack.c') diff --git a/index-pack.c b/index-pack.c index 82c8da3683..8403c36b63 100644 --- a/index-pack.c +++ b/index-pack.c @@ -634,7 +634,8 @@ static void final(const char *final_pack_name, const char *curr_pack_name, write_or_die(keep_fd, keep_msg, keep_msg_len); write_or_die(keep_fd, "\n", 1); } - close(keep_fd); + if (close(keep_fd) != 0) + die("cannot write keep file"); report = "keep"; } } -- cgit v1.2.3