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>
Linus Torvalds committed
Mar 24, 2009 at 12:31 UTC
e8bd78c3fcba35b8344ea6bab6218b793e507ea3
1 file changed
+1
-1
sha1_file.c
+1
-1
@@ -2241,7 +2241,7 @@ static void close_sha1_file(int fd)
2241
fsync_or_die(fd, "sha1 file");
2242
fchmod(fd, 0444);
2243
if (close(fd) != 0)
2244
- die("unable to write sha1 file");
2244
+ die("error when closing sha1 file (%s)", strerror(errno));
2245
}
2246
2247
/* Size of directory component, including the ending '/' */