Merge branch 'jc/maint-fsck-fwrite-size-check'

* jc/maint-fsck-fwrite-size-check:
  fsck: do not abort upon finding an empty blob
This commit is contained in:
Junio C Hamano 2011-10-05 12:35:54 -07:00
commit e2b1405b94

View File

@ -231,12 +231,9 @@ static void check_unreachable_object(struct object *obj)
unsigned long size; unsigned long size;
char *buf = read_sha1_file(obj->sha1, char *buf = read_sha1_file(obj->sha1,
&type, &size); &type, &size);
if (buf) { if (buf && fwrite(buf, 1, size, f) != size)
if (fwrite(buf, size, 1, f) != 1) die_errno("Could not write '%s'", filename);
die_errno("Could not write '%s'",
filename);
free(buf); free(buf);
}
} else } else
fprintf(f, "%s\n", sha1_to_hex(obj->sha1)); fprintf(f, "%s\n", sha1_to_hex(obj->sha1));
if (fclose(f)) if (fclose(f))