From: Linus Torvalds Date: Tue, 24 Mar 2009 19:31:36 +0000 (-0700) Subject: close_sha1_file(): make it easier to diagnose errors X-Git-Tag: v1.6.1.4~3^2~8 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/e8bd78c3fcba35b8344ea6bab6218b793e507ea3?hp=--cc 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 --- e8bd78c3fcba35b8344ea6bab6218b793e507ea3 diff --git a/sha1_file.c b/sha1_file.c index bea958ec81..bcfcab351d 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -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 '/' */