Skip to content

Commit 6651c3f

Browse files
RoelKluingitster
authored andcommitted
fread does not return negative on error
size_t res cannot be less than 0. fread returns 0 on error. Reported-by: Ingo Molnar <[email protected]> Signed-off-by: Roel Kluin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1ab012c commit 6651c3f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

strbuf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ size_t strbuf_fread(struct strbuf *sb, size_t size, FILE *f)
260260
res = fread(sb->buf + sb->len, 1, size, f);
261261
if (res > 0)
262262
strbuf_setlen(sb, sb->len + res);
263-
else if (res < 0 && oldalloc == 0)
263+
else if (oldalloc == 0)
264264
strbuf_release(sb);
265265
return res;
266266
}

0 commit comments

Comments
 (0)