From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: roel kluin <roel.kluin@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>,
git@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] fread does not return negative on error
Date: Mon, 22 Jun 2009 18:42:33 +0200 [thread overview]
Message-ID: <4A3FB479.2090902@lsrfire.ath.cx> (raw)
In-Reply-To: <25e057c00906220847t15425f38maf486c291d1d2468@mail.gmail.com>
Hi,
the following patch is for git. I just removed the unneeded check for
res == 0 from your version. Does it look OK?
Thanks,
René
--- snip! ---
From: Roel Kluin <roel.kluin@gmail.com>
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>
---
strbuf.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/strbuf.c b/strbuf.c
index a884960..f03d117 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;
}
next prev parent reply other threads:[~2009-06-22 16:42 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 ` [PATCH] tools: fread does not return negative on error Ingo Molnar
2009-06-22 15:47 ` roel kluin
2009-06-22 16:42 ` René Scharfe [this message]
2009-06-23 23:56 ` [PATCH] " 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=4A3FB479.2090902@lsrfire.ath.cx \
--to=rene.scharfe@lsrfire.ath.cx \
--cc=akpm@linux-foundation.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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).