diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-06-22 18:42:33 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-06-23 16:57:15 -0700 |
commit | 6651c3f706cc47d8055ab43f9f7907202d10655d (patch) | |
tree | 88eabb5c4a3431fa8f3489565ace175167232217 /strbuf.c | |
parent | t3700-add: add a POSIXPERM prerequisite to a new test (diff) | |
download | tgif-6651c3f706cc47d8055ab43f9f7907202d10655d.tar.xz |
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>
Diffstat (limited to 'strbuf.c')
-rw-r--r-- | strbuf.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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; } |