In article <20130126205325.gd28...@snowdrop.l8s.co.uk>, David Laight <da...@l8s.co.uk> wrote:
>I'd have been tempted to do: > >int stupid_glibc_wont_let_us_ignore_the_result_of_write(int fd, const >void *buf, size_t len) >{ > return write(fd, buf, len); >} It is the linux headers :-) >I'm not sure, but I think that read/write can only return EAGAIN if they >are blocking, have transferred no data, and take a signal that is >restartable. The other way around O_NONBLOCK reads and writes can return EAGAIN on non-files. >If they have transferred some data they they have to return a partial count. But if they are empty(read) or full(write) and non-blocking they have to return EAGAIN (or the old EWOULDBLOCK). >So if you care about the result you have to do far more than loop >for EAGAIN - adding such a loop is a bogus fix. If they are non blocking it is correct; if they are blocking it is a noop. >Not much point writing an error is you'vejust failed to write to stderr! correct. christos