提交 25f3af3f 编写于 作者: B Björn Steinbrink 提交者: Junio C Hamano

Correctly report corrupted objects

The errno check added in commit 3ba7a065 "A loose object is not corrupt
if it cannot be read due to EMFILE" only checked for whether errno is
not ENOENT and thus incorrectly treated "no error" as an error
condition.

Because of that, it never reached the code path that would report that
the object is corrupted and instead caused funny errors like:

  fatal: failed to read object 333c4768ce595793fdab1ef3a036413e2a883853: Success

So we have to extend the check to cover the case in which the object
file was successfully read, but its contents are corrupted.
Reported-by: NWill Palmer <wmpalmer@gmail.com>
Signed-off-by: NBjörn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 b20e9b0b
......@@ -2141,7 +2141,7 @@ void *read_sha1_file_repl(const unsigned char *sha1,
return data;
}
if (errno != ENOENT)
if (errno && errno != ENOENT)
die_errno("failed to read object %s", sha1_to_hex(sha1));
/* die if we replaced an object with one that does not exist */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册