From 6651c3f706cc47d8055ab43f9f7907202d10655d Mon Sep 17 00:00:00 2001 From: Roel Kluin Date: Mon, 22 Jun 2009 18:42:33 +0200 Subject: [PATCH] fread does not return negative on error size_t res cannot be less than 0. fread returns 0 on error. Reported-by: Ingo Molnar Signed-off-by: Roel Kluin Signed-off-by: Junio C Hamano --- strbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strbuf.c b/strbuf.c index a88496030..f03d11702 100644 --- a/strbuf.c +++ b/strbuf.c @@ -260,7 +260,7 @@ size_t strbuf_fread(struct strbuf *sb, size_t size, FILE *f) res = fread(sb->buf + sb->len, 1, size, f); if (res > 0) strbuf_setlen(sb, sb->len + res); - else if (res < 0 && oldalloc == 0) + else if (oldalloc == 0) strbuf_release(sb); return res; } -- 2.26.2