From: Roel Kluin Date: Mon, 22 Jun 2009 16:42:33 +0000 (+0200) Subject: fread does not return negative on error X-Git-Tag: v1.6.4-rc0~10^2~12 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6651c3f706cc47d8055ab43f9f7907202d10655d;p=git.git 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 --- 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; }