Blame SOURCES/LibVNCServer-0.9.9-libvncserver-sockets.c-do-not-segfault-when-listenSo.patch

25ffbd
From 66282f58000c8863e104666c30cb67b1d5cbdee3 Mon Sep 17 00:00:00 2001
25ffbd
From: "Kyle J. McKay" <mackyle@gmail.com>
25ffbd
Date: Fri, 18 May 2012 00:30:11 -0700
25ffbd
Subject: [PATCH] libvncserver/sockets.c: do not segfault when
25ffbd
 listenSock/listen6Sock == -1
25ffbd
MIME-Version: 1.0
25ffbd
Content-Type: text/plain; charset=UTF-8
25ffbd
Content-Transfer-Encoding: 8bit
25ffbd
25ffbd
Signed-off-by: Petr Písař <ppisar@redhat.com>
25ffbd
---
25ffbd
 libvncserver/sockets.c | 4 ++--
25ffbd
 1 file changed, 2 insertions(+), 2 deletions(-)
25ffbd
25ffbd
diff --git a/libvncserver/sockets.c b/libvncserver/sockets.c
25ffbd
index 84c9c98..3ff2aac 100644
25ffbd
--- a/libvncserver/sockets.c
25ffbd
+++ b/libvncserver/sockets.c
25ffbd
@@ -402,9 +402,9 @@ rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen)
25ffbd
       rfbLogPerror("rfbProcessNewConnection: error in select");
25ffbd
       return FALSE;
25ffbd
     }
25ffbd
-    if (FD_ISSET(rfbScreen->listenSock, &listen_fds)) 
25ffbd
+    if (rfbScreen->listenSock >= 0 && FD_ISSET(rfbScreen->listenSock, &listen_fds))
25ffbd
       chosen_listen_sock = rfbScreen->listenSock;
25ffbd
-    if (FD_ISSET(rfbScreen->listen6Sock, &listen_fds)) 
25ffbd
+    if (rfbScreen->listen6Sock >= 0 && FD_ISSET(rfbScreen->listen6Sock, &listen_fds))
25ffbd
       chosen_listen_sock = rfbScreen->listen6Sock;
25ffbd
 
25ffbd
     if ((sock = accept(chosen_listen_sock,
25ffbd
-- 
25ffbd
2.13.5
25ffbd