diff options
author | Alex Riesen <raa.lkml@gmail.com> | 2008-12-05 01:35:48 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-12-04 18:05:41 -0800 |
commit | 47d32af2338418275ab6b53a737952af22289d97 (patch) | |
tree | 1446f6e7851b452c44fd3a90a243aeeccc7dbf67 /builtin-fsck.c | |
parent | 123ed6590836405acb4a0c38e2e4c1b06b4e49a9 (diff) | |
download | git-47d32af2338418275ab6b53a737952af22289d97.tar.gz |
Make some of fwrite/fclose/write/close failures visible
So that full filesystem conditions or permissions problems won't go
unnoticed.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-fsck.c')
-rw-r--r-- | builtin-fsck.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/builtin-fsck.c b/builtin-fsck.c index d3f3de9446..afded5e68d 100644 --- a/builtin-fsck.c +++ b/builtin-fsck.c @@ -201,12 +201,16 @@ static void check_unreachable_object(struct object *obj) char *buf = read_sha1_file(obj->sha1, &type, &size); if (buf) { - fwrite(buf, size, 1, f); + if (fwrite(buf, size, 1, f) != 1) + die("Could not write %s: %s", + filename, strerror(errno)); free(buf); } } else fprintf(f, "%s\n", sha1_to_hex(obj->sha1)); - fclose(f); + if (fclose(f)) + die("Could not finish %s: %s", + filename, strerror(errno)); } return; } |