Blob Blame History Raw
diff --git a/unix/xserver/hw/vnc/xvnc.cc b/unix/xserver/hw/vnc/xvnc.cc
index 5c0e171..c79ad18 100644
--- a/unix/xserver/hw/vnc/xvnc.cc
+++ b/unix/xserver/hw/vnc/xvnc.cc
@@ -352,7 +352,10 @@ static
 bool displayNumFree(int num)
 {
     try {
-	network::TcpListener l(NULL, 6000+num);
+      // Attempt to create TCPListeners on that port.
+      // They go out of scope immediately and are destroyed.
+      std::list<network::TcpListener> dummy;
+      network::createTcpListeners (&dummy, 0, 6000+num);
     } catch (rdr::Exception& e) {
 	return false;
     }