@matheusbsbs / matheus-bagliano / commits / 6651c3f706
Fork 0

fread does not return negative on error

size_t res cannot be less than 0. fread returns 0 on error. Reported-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Roel Kluin committed Jun 22, 2009 at 18:42 UTC 6651c3f706cc47d8055ab43f9f7907202d10655d
1 file changed +1 -1
strbuf.c
+1 -1
@@ -260,7 +260,7 @@ size_t strbuf_fread(struct strbuf *sb, size_t size, FILE *f)
260 res = fread(sb->buf + sb->len, 1, size, f);
261 if (res > 0)
262 strbuf_setlen(sb, sb->len + res);
263 - else if (res < 0 && oldalloc == 0)
263 + else if (oldalloc == 0)
264 strbuf_release(sb);
265 return res;
266 }