Skip to content

Commit 23c7df6

Browse files
meyeringgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 93aa7bd commit 23c7df6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sha1_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2733,7 +2733,7 @@ static int index_stream(unsigned char *sha1, int fd, size_t size,
27332733
while (size) {
27342734
char buf[10240];
27352735
size_t sz = size < sizeof(buf) ? size : sizeof(buf);
2736-
size_t actual;
2736+
ssize_t actual;
27372737

27382738
actual = read_in_full(fd, buf, sz);
27392739
if (actual < 0)

0 commit comments

Comments
 (0)