Skip to content

Commit

Permalink
Merge branch 'jc/maint-fsck-fwrite-size-check' into maint
Browse files Browse the repository at this point in the history
* jc/maint-fsck-fwrite-size-check:
  fsck: do not abort upon finding an empty blob
  • Loading branch information
Junio C Hamano committed Oct 16, 2011
2 parents a151c28 + eb726f2 commit d7b7dd3
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions builtin/fsck.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit d7b7dd3

Please sign in to comment.