diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-06-22 12:42:33 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-24 04:22:06 -0400 |
commit | f7679dabfaf69840b000d238a020cee7157aca17 (patch) | |
tree | 6b3974205b911b505fbce14588ac3e3f62a591b8 /tools/perf/util/strbuf.c | |
parent | cca03c0aeb18a975abec28df518a2b64ae3e6964 (diff) |
perf_counter tools: Fix strbuf_fread() error path handling
size_t res cannot be less than 0 - fread returns 0 on error.
[ Updated by: René Scharfe <rene.scharfe@lsrfire.ath.cx> ]
Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Junio C Hamano <gitster@pobox.com>
LKML-Reference: <4A3FB479.2090902@lsrfire.ath.cx>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/strbuf.c')
-rw-r--r-- | tools/perf/util/strbuf.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/strbuf.c b/tools/perf/util/strbuf.c index eaba09306802..464e7ca898cf 100644 --- a/tools/perf/util/strbuf.c +++ b/tools/perf/util/strbuf.c | |||
@@ -259,7 +259,7 @@ size_t strbuf_fread(struct strbuf *sb, size_t size, FILE *f) | |||
259 | res = fread(sb->buf + sb->len, 1, size, f); | 259 | res = fread(sb->buf + sb->len, 1, size, f); |
260 | if (res > 0) | 260 | if (res > 0) |
261 | strbuf_setlen(sb, sb->len + res); | 261 | strbuf_setlen(sb, sb->len + res); |
262 | else if (res < 0 && oldalloc == 0) | 262 | else if (oldalloc == 0) |
263 | strbuf_release(sb); | 263 | strbuf_release(sb); |
264 | return res; | 264 | return res; |
265 | } | 265 | } |