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>
Jim Meyering committed
May 26, 2011 at 16:34 UTC
23c7df6bdd13e3d99ca09b6a7655747cc29ccc41
1 file changed
+1
-1
sha1_file.c
+1
-1
@@ -2733,7 +2733,7 @@ static int index_stream(unsigned char *sha1, int fd, size_t size,
2733
while (size) {
2734
char buf[10240];
2735
size_t sz = size < sizeof(buf) ? size : sizeof(buf);
2736
- size_t actual;
2736
+ ssize_t actual;
2737
2738
actual = read_in_full(fd, buf, sz);
2739
if (actual < 0)