summaryrefslogtreecommitdiff
path: root/index-pack.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2007-06-24 21:20:41 +0200
committerJunio C Hamano <gitster@pobox.com>2007-06-26 21:48:53 -0700
commit91c8d5905c33e9d7c9014a1c6c7cec8eb86584df (patch)
treec3dbbc16aa7df268aae8962bc4cac367fc5c51ca /index-pack.c
parent2275d502114c71045af991697048191fed88aac4 (diff)
downloadgit-91c8d5905c33e9d7c9014a1c6c7cec8eb86584df.tar.gz
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 <jim@meyering.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'index-pack.c')
-rw-r--r--index-pack.c3
1 files changed, 2 insertions, 1 deletions
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";
}
}