I'm connecting a socket asynchronously (O_NONBLOCK + connect). POSIX standard specifies that after socket has been connected is should signal the event by making the file descriptor for the socket ready for writing. It doesn't seem to say anything about failures during async connect.
When testing it on Linux, it seems that sometimes I'm getting POLLOUT and sometimes POLLERR in this situation. Is there any pattern in the behaviour? Can I make it report the errors in a single way? Does POSIX say something I have overlooked?