On Mon, 2019-05-27 at 17:12 +0200, Ondrej Zajicek wrote: > CAUTION: This email originated from outside of the organization. Do > not click links or open attachments unless you recognize the sender > and know the content is safe. > > > On Mon, May 27, 2019 at 02:28:52PM +0200, Kenth Eriksson wrote: > > Datagram sockets may return 0 and stream sockets can return 0 > > if the requested number of bytes to read is 0. > > Hi > > You mean that if count arg to read() is 0? > > How that may happen? > We have a client remote controlling bird using a socket that did get get POLLHUP, maybe due to that bird closed the socket.
Don't think checking for 0 is enough, from man page; "When a stream socket peer has performed an orderly shutdown, the return value will be 0 (the traditional "end-of-file" return). Datagram sockets in various domains (e.g., the UNIX and Internet domains) permit zero-length datagrams. When such a datagram is received, the return value is 0. The value 0 may also be returned if the requested number of bytes to receive from a stream socket was 0." > -- > Elen sila lumenn' omentielvo > > Ondrej 'Santiago' Zajicek (email: santi...@crfreenet.org) > OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, > wwwkeys.pgp.net) > "To err is human -- to blame it on a computer is even more so."