summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1ab012c)
raw | patch | inline | side by side (parent: 1ab012c)
author | Roel Kluin <roel.kluin@gmail.com> | |
Mon, 22 Jun 2009 16:42:33 +0000 (18:42 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 23 Jun 2009 23:57:15 +0000 (16:57 -0700) |
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>
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>
strbuf.c | patch | blob | history |
diff --git a/strbuf.c b/strbuf.c
index a88496030b7053a543173c299bd9f54b923db2ec..f03d11702b3f6212ca7305df60f2f9ea6ca49e35 100644 (file)
--- a/strbuf.c
+++ b/strbuf.c
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;
}