summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Kiagiadakis <kiagiadakis.george@gmail.com>2010-11-14 16:13:43 +0000
committerChristian Beier <dontmind@freeshell.org>2011-06-01 13:04:50 +0200
commitddd9b5ac7bd12a778452b3aefbf9502e7a0a9779 (patch)
tree14ed050b8c9c85956996799ee35f14cd6cbd9cce
parent9f8d8d4ef38951767aa428796df127ff80de9b6e (diff)
downloadlibvncserver-ddd9b5ac7bd12a778452b3aefbf9502e7a0a9779.zip
libvncserver-ddd9b5ac7bd12a778452b3aefbf9502e7a0a9779.tar.gz
Fix rfbProcessNewConnection to return some value instead of void.
BUG: 256891 Signed-off-by: Christian Beier <dontmind@freeshell.org>
-rw-r--r--libvncserver/sockets.c15
-rw-r--r--rfb/rfb.h2
2 files changed, 10 insertions, 7 deletions
diff --git a/libvncserver/sockets.c b/libvncserver/sockets.c
index b7ea8c1..c7dc35f 100644
--- a/libvncserver/sockets.c
+++ b/libvncserver/sockets.c
@@ -260,7 +260,8 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
if (rfbScreen->listenSock != -1 && FD_ISSET(rfbScreen->listenSock, &fds)) {
- rfbProcessNewConnection(rfbScreen);
+ if (!rfbProcessNewConnection(rfbScreen))
+ return -1;
FD_CLR(rfbScreen->listenSock, &fds);
if (--nfds == 0)
@@ -322,7 +323,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
return result;
}
-void
+rfbBool
rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen)
{
const int one = 1;
@@ -333,19 +334,19 @@ rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen)
if ((sock = accept(rfbScreen->listenSock,
(struct sockaddr *)&addr, &addrlen)) < 0) {
rfbLogPerror("rfbCheckFds: accept");
- return -1;
+ return FALSE;
}
if(!rfbSetNonBlocking(sock)) {
closesocket(sock);
- return -1;
+ return FALSE;
}
if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
(char *)&one, sizeof(one)) < 0) {
rfbLogPerror("rfbCheckFds: setsockopt");
closesocket(sock);
- return -1;
+ return FALSE;
}
#ifdef USE_LIBWRAP
@@ -354,13 +355,15 @@ rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen)
rfbLog("Rejected connection from client %s\n",
inet_ntoa(addr.sin_addr));
closesocket(sock);
- return -1;
+ return FALSE;
}
#endif
rfbLog("Got connection from client %s\n", inet_ntoa(addr.sin_addr));
rfbNewClient(rfbScreen,sock);
+
+ return TRUE;
}
diff --git a/rfb/rfb.h b/rfb/rfb.h
index 12c5278..c16336d 100644
--- a/rfb/rfb.h
+++ b/rfb/rfb.h
@@ -1007,7 +1007,7 @@ extern rfbBool rfbSendTextChatMessage(rfbClientPtr cl, uint32_t length, char *bu
* Additions for Qt event loop integration
* Original idea taken from vino.
*/
-void rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen);
+rfbBool rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen);
rfbBool rfbUpdateClient(rfbClientPtr cl);
OpenPOWER on IntegriCloud