From: Junio C Hamano Date: Sat, 25 Aug 2007 08:26:47 +0000 (-0700) Subject: pack-objects: check return value from read_sha1_file() X-Git-Tag: v1.5.3-rc7~24 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2e3404c3245e1e0031ef0a6574f25e8c35d5aac3;p=git.git pack-objects: check return value from read_sha1_file() Signed-off-by: Junio C Hamano --- diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c index 77481df5d..9b3ef94c4 100644 --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c @@ -1356,6 +1356,9 @@ static int try_delta(struct unpacked *trg, struct unpacked *src, /* Load data if not already done */ if (!trg->data) { trg->data = read_sha1_file(trg_entry->idx.sha1, &type, &sz); + if (!trg->data) + die("object %s cannot be read", + sha1_to_hex(trg_entry->idx.sha1)); if (sz != trg_size) die("object %s inconsistent object length (%lu vs %lu)", sha1_to_hex(trg_entry->idx.sha1), sz, trg_size); @@ -1363,6 +1366,9 @@ static int try_delta(struct unpacked *trg, struct unpacked *src, } if (!src->data) { src->data = read_sha1_file(src_entry->idx.sha1, &type, &sz); + if (!src->data) + die("object %s cannot be read", + sha1_to_hex(src_entry->idx.sha1)); if (sz != src_size) die("object %s inconsistent object length (%lu vs %lu)", sha1_to_hex(src_entry->idx.sha1), sz, src_size);