summaryrefslogtreecommitdiff
path: root/builtin/fsck.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2011-10-05 12:35:54 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2011-10-05 12:35:54 -0700
commite2b1405b9445ad87f19625a3740eb802b3f7472f (patch)
tree362eb77bd13b1f69cd15b01e7633ca4341cba4b0 /builtin/fsck.c
parentMerge branch 'bk/ancestry-path' (diff)
parentfsck: do not abort upon finding an empty blob (diff)
downloadtgif-e2b1405b9445ad87f19625a3740eb802b3f7472f.tar.xz
Merge branch 'jc/maint-fsck-fwrite-size-check'
* jc/maint-fsck-fwrite-size-check: fsck: do not abort upon finding an empty blob
Diffstat (limited to 'builtin/fsck.c')
-rw-r--r--builtin/fsck.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 5ae0366bc8..df1a88b51a 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))