close_sha1_file(): make it easier to diagnose errors

A bug report with "unable to write sha1 file" made us realize that we do
not have enough information to guess why close() is failing.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Linus Torvalds 2009-03-24 12:31:36 -07:00 committed by Junio C Hamano
parent 720fe22d50
commit e8bd78c3fc

View file

@ -2241,7 +2241,7 @@ static void close_sha1_file(int fd)
fsync_or_die(fd, "sha1 file");
fchmod(fd, 0444);
if (close(fd) != 0)
die("unable to write sha1 file");
die("error when closing sha1 file (%s)", strerror(errno));
}
/* Size of directory component, including the ending '/' */