Skip to content

Commit

Permalink
sha1_file: use the correct type (ssize_t, not size_t) for read-style …
Browse files Browse the repository at this point in the history
…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]>
  • Loading branch information
meyering authored and gitster committed May 26, 2011
1 parent 93aa7bd commit 23c7df6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sha1_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 23c7df6

Please sign in to comment.