Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)
From: Ilari Liusvaara <hidden>
Date: 2016-06-15 22:49:18
On Thu, Aug 12, 2010 at 12:31:33PM +0200, Johannes Sixt wrote:
builtin/remote-ext.c uses a loop that looks very much like what write_in_full() does; transport-helper.c's checks for EAGAIN look very similar to xwrite(). Why can't you reuse these functions?
Ah, the request sending loop (send_git_request()), not the bidirectional loop (my bad). Yes, that function can be simplified a lot (patch sent).
quoted
[1] Some systems return EAGAIN on read/write failed due to blocking (with EAGAIN == EWOULDBLOCK), others return EWOULDBLOCK.But shouldn't then xwrite() and xread() be extended to check also for EWOULDBLOCK?
Based on what I understand, yes. read() and write() that fails due to blocking being needed but disabled returns EWOULDBLOCK, which may or may not be the same as EAGAIN, so the return value in no-blocking case equals EAGAIN only if EAGAIN == EWOULDBLOCK, which isn't guaranteed. Have a macro that does the non-fatal error check? -Ilari