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: Jim Meyering <meyering@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
93aa7bd595
commit
23c7df6bdd
@ -2733,7 +2733,7 @@ static int index_stream(unsigned char *sha1, int fd, size_t size,
|
|||||||
while (size) {
|
while (size) {
|
||||||
char buf[10240];
|
char buf[10240];
|
||||||
size_t sz = size < sizeof(buf) ? size : sizeof(buf);
|
size_t sz = size < sizeof(buf) ? size : sizeof(buf);
|
||||||
size_t actual;
|
ssize_t actual;
|
||||||
|
|
||||||
actual = read_in_full(fd, buf, sz);
|
actual = read_in_full(fd, buf, sz);
|
||||||
if (actual < 0)
|
if (actual < 0)
|
||||||
|
Reference in New Issue
Block a user