From: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
To: Brian Harring <ferringb@gmail.com>
Cc: git@vger.kernel.org, spearce@spearce.org
Subject: Re: [PATCH] fix hang in git fetch if pointed at a 0 length bundle
Date: Tue, 3 Jan 2012 19:07:53 +0700 [thread overview]
Message-ID: <CACsJy8B5B2bx7WK7ViziseuWCPaMgcc-avwtsw2DybRme8Vgfg@mail.gmail.com> (raw)
In-Reply-To: <20120103011352.GA13825@localhost>
On Tue, Jan 3, 2012 at 8:13 AM, Brian Harring <ferringb@gmail.com> wrote:
> @@ -31,7 +31,7 @@ static int strbuf_readline_fd(struct strbuf *sb, int fd)
> while (1) {
> char ch;
> ssize_t len = xread(fd, &ch, 1);
> - if (len < 0)
> + if (len <= 0)
> return -1;
> strbuf_addch(sb, ch);
> if (ch == '\n')
I think it should return 0 when len == 0 because strictly speaking eof
is not a fault. It's not really important though because the two
callers in this file work fine either way.
FWIW I went through all xread call sites. All seem to handle return
value <= 0 correctly.
--
Duy
next prev parent reply other threads:[~2012-01-03 12:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-03 1:13 [PATCH] fix hang in git fetch if pointed at a 0 length bundle Brian Harring
2012-01-03 8:35 ` Johannes Sixt
2012-01-03 12:07 ` Nguyen Thai Ngoc Duy [this message]
2012-01-03 20:11 ` Junio C Hamano
2012-01-03 13:46 ` Brian Harring
2012-01-03 20:13 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CACsJy8B5B2bx7WK7ViziseuWCPaMgcc-avwtsw2DybRme8Vgfg@mail.gmail.com \
--to=pclouds@gmail.com \
--cc=ferringb@gmail.com \
--cc=git@vger.kernel.org \
--cc=spearce@spearce.org \
/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.
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 NNTP newsgroup(s).