From: Markus L. <de...@ma...> - 2017-02-01 12:48:51
|
On Wed, 1 Feb 2017 13:17:41 +0100 Markus Lauterbach <de...@ma...> wrote: > On Tue, 31 Jan 2017 10:27:56 +0100 > Michael Kress <m-...@m-...> wrote: > > > Hi list, > > > > this is a patch originally fixed by MBR: > > If read() returns -1 and the errno says EAGAIN or EWOULDBLOCK, the > > socket is not necessarily defective. > > > > Looks good, but errno should only be checked > if read returns -1 and not > if read returns 0. > Some code for a better explanation: read_bytes = read(...); if (read_bytes == -1) { if (errno == EAGAIN || errno == EWOULDBLOCK) return 0; else return -1; } else if (read_bytes == 0) { return -1; /* eof */ } else { /* yeah, got some data */ } > Markus > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > _______________________________________________ > mcip-list mailing list > mci...@li... > https://lists.sourceforge.net/lists/listinfo/mcip-list |