From 23c7df6bdd13e3d99ca09b6a7655747cc29ccc41 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 26 May 2011 16:34:20 +0200 Subject: 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 Signed-off-by: Junio C Hamano diff --git a/sha1_file.c b/sha1_file.c index 5fc877f..8a85217 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -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) -- cgit v0.10.2-6-g49f6