summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libvncclient/listen.c2
-rw-r--r--libvncclient/rfbproto.c2
-rw-r--r--libvncclient/vncviewer.c7
-rw-r--r--libvncserver/rfbserver.c2
4 files changed, 8 insertions, 5 deletions
diff --git a/libvncclient/listen.c b/libvncclient/listen.c
index d1e98ae..7a0501c 100644
--- a/libvncclient/listen.c
+++ b/libvncclient/listen.c
@@ -127,7 +127,7 @@ listenForIncomingConnectionsNoFork(rfbClient* client, int timeout)
client->listenSpecified = TRUE;
- if (! client->listenSock)
+ if (client->listenSock < 0)
{
client->listenSock = ListenAtTcpPort(client->listenPort);
diff --git a/libvncclient/rfbproto.c b/libvncclient/rfbproto.c
index 57a3a54..76b501a 100644
--- a/libvncclient/rfbproto.c
+++ b/libvncclient/rfbproto.c
@@ -388,7 +388,7 @@ ConnectToRFBServer(rfbClient* client,const char *hostname, int port)
fclose(rec->file);
return FALSE;
}
- client->sock = 0;
+ client->sock = -1;
return TRUE;
}
diff --git a/libvncclient/vncviewer.c b/libvncclient/vncviewer.c
index b5fb420..0361827 100644
--- a/libvncclient/vncviewer.c
+++ b/libvncclient/vncviewer.c
@@ -190,7 +190,8 @@ rfbClient* rfbGetClient(int bitsPerSample,int samplesPerPixel,
#ifdef LIBVNCSERVER_WITH_CLIENT_TLS
client->tlsSession = NULL;
#endif
-
+ client->sock = -1;
+ client->listenSock = -1;
return client;
}
@@ -334,8 +335,10 @@ void rfbClientCleanup(rfbClient* client) {
#endif
FreeTLS(client);
- if (client->sock > 0)
+ if (client->sock >= 0)
close(client->sock);
+ if (client->listenSock >= 0)
+ close(client->listenSock);
free(client->desktopName);
free(client->serverHost);
free(client);
diff --git a/libvncserver/rfbserver.c b/libvncserver/rfbserver.c
index bb9c665..465d767 100644
--- a/libvncserver/rfbserver.c
+++ b/libvncserver/rfbserver.c
@@ -485,7 +485,7 @@ rfbClientConnectionGone(rfbClientPtr cl)
if (cl->next)
cl->next->prev = cl->prev;
- if(cl->sock>0)
+ if(cl->sock>=0)
close(cl->sock);
if (cl->scaledScreen!=NULL)