summaryrefslogtreecommitdiffstats
path: root/unix/xserver
diff options
context:
space:
mode:
authorTristan Schmelcher <tristan_schmelcher@alumni.uwaterloo.ca>2011-09-02 15:29:25 -0700
committerPierre Ossman <ossman@cendio.se>2015-12-29 15:11:26 +0100
commite5afb92cb9454b3e4018f4ccb088a089da2b1228 (patch)
tree808fa899b42e251385d46c9e76d6af0534e362c1 /unix/xserver
parent1f8aba3147ec13aaa70a44372775b72bb4e59941 (diff)
downloadtigervnc-e5afb92cb9454b3e4018f4ccb088a089da2b1228.tar.gz
tigervnc-e5afb92cb9454b3e4018f4ccb088a089da2b1228.zip
Fix race problem with detecting listening inetd sockets
The previous detection would fail if the socket closed before we had time to inspect it, which got us stuck in a loop as we would try (and fail) to do accept() on a non-listening socket.
Diffstat (limited to 'unix/xserver')
-rw-r--r--unix/xserver/hw/vnc/vncExtInit.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/unix/xserver/hw/vnc/vncExtInit.cc b/unix/xserver/hw/vnc/vncExtInit.cc
index 2d918b04..863cd36b 100644
--- a/unix/xserver/hw/vnc/vncExtInit.cc
+++ b/unix/xserver/hw/vnc/vncExtInit.cc
@@ -137,8 +137,7 @@ void vncExtensionInit(void)
std::list<network::TcpListener*> listeners;
std::list<network::TcpListener*> httpListeners;
if (scr == 0 && vncInetdSock != -1) {
- if (network::TcpSocket::isSocket(vncInetdSock) &&
- !network::TcpSocket::isConnected(vncInetdSock))
+ if (network::TcpSocket::isListening(vncInetdSock))
{
listeners.push_back(new network::TcpListener(vncInetdSock));
vlog.info("inetd wait");