summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgkiagia <gkiagia@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-11-14 16:13:43 +0000
committergkiagia <gkiagia@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-11-14 16:13:43 +0000
commitc31476a19688400a450d267097858be17aba3a9a (patch)
tree1ab79f228b08a68844ee5b18e3214947f9b6df6f
parent22946807bea930004684ffd6bf7bc48171988391 (diff)
downloadlibvncserver-c31476a19688400a450d267097858be17aba3a9a.zip
libvncserver-c31476a19688400a450d267097858be17aba3a9a.tar.gz
Fix rfbProcessNewConnection to return some value instead of void.
BUG: 256891 git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/KDE/kdenetwork/krfb/libvncserver@1196995 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
-rw-r--r--rfb/rfb.h2
-rwxr-xr-xsockets.c15
2 files changed, 10 insertions, 7 deletions
diff --git a/rfb/rfb.h b/rfb/rfb.h
index 7632e97..8781291 100644
--- a/rfb/rfb.h
+++ b/rfb/rfb.h
@@ -971,7 +971,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);
diff --git a/sockets.c b/sockets.c
index 71e1802..dd33bde 100755
--- a/sockets.c
+++ b/sockets.c
@@ -264,7 +264,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)
@@ -326,7 +327,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
return result;
}
-void
+rfbBool
rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen)
{
const int one = 1;
@@ -337,14 +338,14 @@ rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen)
if ((sock = accept(rfbScreen->listenSock,
(struct sockaddr *)&addr, &addrlen)) < 0) {
rfbLogPerror("rfbCheckFds: accept");
- return -1;
+ return FALSE;
}
#ifndef WIN32
if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0) {
rfbLogPerror("rfbCheckFds: fcntl");
closesocket(sock);
- return -1;
+ return FALSE;
}
#endif
@@ -352,7 +353,7 @@ rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen)
(char *)&one, sizeof(one)) < 0) {
rfbLogPerror("rfbCheckFds: setsockopt");
closesocket(sock);
- return -1;
+ return FALSE;
}
#ifdef USE_LIBWRAP
@@ -361,13 +362,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;
}
OpenPOWER on IntegriCloud