Fix WaitLatchOrSocket to handle EOF on socket correctly.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 12 May 2012 20:36:47 +0000 (16:36 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 12 May 2012 20:36:47 +0000 (16:36 -0400)
commit31ad6553646c81f3ce8fccf8aef1a1134a7864c7
tree3e50b673543a07032e2ec6ff5dd3776a342a77f7
parentd36eaa2167c4baaa654a19432035f47fdf6fbe7d
Fix WaitLatchOrSocket to handle EOF on socket correctly.

When using poll(), EOF on a socket is reported with the POLLHUP not
POLLIN flag (at least on Linux).  WaitLatchOrSocket failed to check
this bit, causing it to go into a busy-wait loop if EOF occurs.
We earlier fixed the same mistake in the test for the state of the
postmaster_alive socket, but missed it for the caller-supplied socket.
Fortunately, this error is new in 9.2, since 9.1 only had a select()
based code path not a poll() based one.
src/backend/port/unix_latch.c