From: Ingo Molnar <mingo@elte.hu>
To: Roel Kluin <roel.kluin@gmail.com>, git@vger.kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] tools: fread does not return negative on error
Date: Mon, 22 Jun 2009 17:34:31 +0200 [thread overview]
Message-ID: <20090622153431.GA18466@elte.hu> (raw)
In-Reply-To: <4A3FB09D.9050903@gmail.com>
* Roel Kluin <roel.kluin@gmail.com> wrote:
> size_t res cannot be less than 0. fread returns 0 on error.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> Is this correct? please review.
>
> diff --git a/tools/perf/util/strbuf.c b/tools/perf/util/strbuf.c
> index eaba093..376a337 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)
> 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 (res == 0 && oldalloc == 0)
> strbuf_release(sb);
> return res;
This comes straight from Git's strbuf.c so i've Cc:-ed the Git list.
Roel, did you get some compiler warning that made you look at this
code?
Ingo
next parent reply other threads:[~2009-06-22 15:34 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4A3FB09D.9050903@gmail.com>
2009-06-22 15:34 ` Ingo Molnar [this message]
2009-06-22 15:47 ` [PATCH] tools: fread does not return negative on error roel kluin
2009-06-22 16:42 ` [PATCH] " René Scharfe
2009-06-23 23:56 ` Junio C Hamano
2009-06-24 8:18 ` Ingo Molnar
2009-06-24 10:03 ` Johannes Schindelin
2009-06-24 16:15 ` Junio C Hamano
2009-06-24 16:40 ` Johannes Schindelin
2009-06-24 17:59 ` Ingo Molnar
2009-06-24 21:19 ` Alex Riesen
2009-06-24 21:55 ` Junio C Hamano
2009-06-24 10:53 ` Christian Couder
2009-06-24 12:12 ` Ingo Molnar
2009-06-25 18:31 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090622153431.GA18466@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@linux-foundation.org \
--cc=git@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=roel.kluin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).