提交 23c7df6b 编写于 作者: J Jim Meyering 提交者: Junio C Hamano

sha1_file: use the correct type (ssize_t, not size_t) for read-style function

Using an unsigned type, we would fail to detect a read error and then
proceed to try to write (size_t)-1 bytes.
Signed-off-by: NJim Meyering <meyering@redhat.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 93aa7bd5
......@@ -2733,7 +2733,7 @@ static int index_stream(unsigned char *sha1, int fd, size_t size,
while (size) {
char buf[10240];
size_t sz = size < sizeof(buf) ? size : sizeof(buf);
size_t actual;
ssize_t actual;
actual = read_in_full(fd, buf, sz);
if (actual < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册