aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-10-15 20:46:38 -0700
committerJunio C Hamano <gitster@pobox.com>2011-10-15 20:46:38 -0700
commitd7b7dd38497ff6877038400b8b009b26d19d8560 (patch)
tree66223161f53cd44969de4b1d35466c3a116d2bc5 /builtin
parenta151c28c729f459390027300f82465a669ba2df9 (diff)
parenteb726f2d760dd78915e4a24f014ab411a165daa3 (diff)
downloadgit-d7b7dd38497ff6877038400b8b009b26d19d8560.tar.gz
git-d7b7dd38497ff6877038400b8b009b26d19d8560.tar.xz
Merge branch 'jc/maint-fsck-fwrite-size-check' into maint
* jc/maint-fsck-fwrite-size-check: fsck: do not abort upon finding an empty blob
Diffstat (limited to 'builtin')
-rw-r--r--builtin/fsck.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 5ae0366bc..df1a88b51 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -231,12 +231,9 @@ static void check_unreachable_object(struct object *obj)
unsigned long size;
char *buf = read_sha1_file(obj->sha1,
&type, &size);
- if (buf) {
- if (fwrite(buf, size, 1, f) != 1)
- die_errno("Could not write '%s'",
- filename);
- free(buf);
- }
+ if (buf && fwrite(buf, 1, size, f) != size)
+ die_errno("Could not write '%s'", filename);
+ free(buf);
} else
fprintf(f, "%s\n", sha1_to_hex(obj->sha1));
if (fclose(f))