Subject: Re: [PATCH] git-daemon wrapper to wait until daemon is ready

From: Clemens Buchacher <[email-masked]>
Date: Sun, 15 Apr 2012 21:32:42 +0200

On Sun, Apr 15, 2012 at 07:11:52PM +0200, Johannes Sixt wrote:
> 
> But reading the first line in this way needs a few assumptions to be true:
> 
> - git-daemon does not write an incomplete line and then waits.

Yes. One way to avoid that assumption would be a timeout.

> - git-daemon does not write more than one line, because xread() happily
> reads everything it can get. Your implementation differs from the old
> version because the shell's 'read' is required to read no more than one
> line, i.e., to read byte-wise from the pipe until it sees the LF.

The strbuf_getwholeline_fd implementation calls xread(fd, buf, 1),
reading only one byte at a time. It does not try to read beyond the
newline.