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>
This commit is contained in:

committed by
Junio C Hamano

parent
2275d50211
commit
91c8d5905c
@ -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";
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user