Fix WaitLatchOrSocket to handle EOF on socket correctly.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 31ad6553646c81f3ce8fccf8aef1a1134a7864c7
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2012-05-12T20:36:47Z
Releases: 9.2.0
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.

Files

PathChange+/−
src/backend/port/unix_latch.c modified +1 −1