On 13/07/2015 10:13, pyssl...@ludd.ltu.se wrote: > Commit 812c1057 introduced HUP detection on unix and tcp sockets prior > to a read in tcp_chr_read. This unfortunately broke CloudStack 4.2 > which relied on the old behaviour where data on a socket was readable > even if a HUP was present. > > On Linux a working solution seems to be to simply check the HUP after > reading available data, while keeping the original behaviour for windows. > > There is then a divergence in behaviour for the two platforms, but this > seems better than breaking a whole software stack.
There is no need to do something special on Windows, I think. You can unconditionally check G_IO_HUP after reading. One nit: > - if (size == 0) { > + if (size == 0 || (size < 0 && cond & G_IO_HUP)) { Please put (cond & G_IO_HUP) within parentheses. Please