diff options
-rw-r--r-- | AUTHORS | 2 | ||||
-rw-r--r-- | libvncclient/listen.c | 2 | ||||
-rw-r--r-- | libvncclient/sockets.c | 30 | ||||
-rw-r--r-- | libvncclient/vncviewer.c | 4 |
4 files changed, 21 insertions, 17 deletions
@@ -24,7 +24,7 @@ archives and please don't beat me, if I forgot you, but just send me an email!): Akira Hatakeyama, Karl J. Runge, Justin "Zippy" Dearing, Oliver Mihatsch, Greg Sternberg, Werner Hofer, Giampiero Giancipoli, Glenn Mabutt, Paul Kreiner, Erik Kunze, Mike Frysinger, Martin Waitz, -Mark McLoughlin, Paul Fox, Juan Jose Costello. +Mark McLoughlin, Paul Fox, Juan Jose Costello, Andre Leiadella. Probably I forgot quite a few people sending a patch here and there, which really made a difference. Without those, some obscure bugs still would diff --git a/libvncclient/listen.c b/libvncclient/listen.c index 1e6f68b..a7e4259 100644 --- a/libvncclient/listen.c +++ b/libvncclient/listen.c @@ -77,7 +77,7 @@ listenForIncomingConnections(rfbClient* client) switch (fork()) { case -1: - perror("fork"); + rfbClientErr("fork"); return; case 0: diff --git a/libvncclient/sockets.c b/libvncclient/sockets.c index 6991616..13cb770 100644 --- a/libvncclient/sockets.c +++ b/libvncclient/sockets.c @@ -120,7 +120,7 @@ ReadFromRFBServer(rfbClient* client, char *out, unsigned int n) */ i = 0; } else { - perror("read"); + rfbClientErr("read"); return FALSE; } } else { @@ -149,7 +149,7 @@ ReadFromRFBServer(rfbClient* client, char *out, unsigned int n) */ i = 0; } else { - perror("read"); + rfbClientErr("read"); return FALSE; } } else { @@ -200,12 +200,12 @@ WriteToRFBServer(rfbClient* client, char *buf, int n) FD_SET(client->sock,&fds); if (select(client->sock+1, NULL, &fds, NULL, NULL) <= 0) { - perror("select"); + rfbClientErr("select"); return FALSE; } j = 0; } else { - perror("write"); + rfbClientErr("write"); return FALSE; } } else { @@ -236,19 +236,19 @@ ConnectClientToTcpAddr(unsigned int host, int port) sock = socket(AF_INET, SOCK_STREAM, 0); if (sock < 0) { - perror("ConnectToTcpAddr: socket"); + rfbClientErr("ConnectToTcpAddr: socket"); return -1; } if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) { - perror("ConnectToTcpAddr: connect"); + rfbClientErr("ConnectToTcpAddr: connect"); close(sock); return -1; } if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *)&one, sizeof(one)) < 0) { - perror("ConnectToTcpAddr: setsockopt"); + rfbClientErr("ConnectToTcpAddr: setsockopt"); close(sock); return -1; } @@ -274,7 +274,7 @@ FindFreeTcpPort(void) sock = socket(AF_INET, SOCK_STREAM, 0); if (sock < 0) { - perror(": FindFreeTcpPort: socket"); + rfbClientErr(": FindFreeTcpPort: socket"); return 0; } @@ -308,25 +308,25 @@ ListenAtTcpPort(int port) sock = socket(AF_INET, SOCK_STREAM, 0); if (sock < 0) { - perror("ListenAtTcpPort: socket"); + rfbClientErr("ListenAtTcpPort: socket"); return -1; } if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char *)&one, sizeof(one)) < 0) { - perror("ListenAtTcpPort: setsockopt"); + rfbClientErr("ListenAtTcpPort: setsockopt"); close(sock); return -1; } if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) { - perror("ListenAtTcpPort: bind"); + rfbClientErr("ListenAtTcpPort: bind"); close(sock); return -1; } if (listen(sock, 5) < 0) { - perror("ListenAtTcpPort: listen"); + rfbClientErr("ListenAtTcpPort: listen"); close(sock); return -1; } @@ -349,13 +349,13 @@ AcceptTcpConnection(int listenSock) sock = accept(listenSock, (struct sockaddr *) &addr, &addrlen); if (sock < 0) { - perror("AcceptTcpConnection: accept"); + rfbClientErr("AcceptTcpConnection: accept"); return -1; } if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *)&one, sizeof(one)) < 0) { - perror("AcceptTcpConnection: setsockopt"); + rfbClientErr("AcceptTcpConnection: setsockopt"); close(sock); return -1; } @@ -372,7 +372,7 @@ rfbBool SetNonBlocking(int sock) { if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0) { - perror("AcceptTcpConnection: fcntl"); + rfbClientErr("AcceptTcpConnection: fcntl"); return FALSE; } return TRUE; diff --git a/libvncclient/vncviewer.c b/libvncclient/vncviewer.c index 914b422..2a11970 100644 --- a/libvncclient/vncviewer.c +++ b/libvncclient/vncviewer.c @@ -91,6 +91,10 @@ static void initAppData(AppData* data) { rfbClient* rfbGetClient(int bitsPerSample,int samplesPerPixel, int bytesPerPixel) { rfbClient* client=(rfbClient*)calloc(sizeof(rfbClient),1); + if(!client) { + rfbClientErr("Couldn't allocate client structure!\n"); + return 0; + } initAppData(&client->appData); client->programName = 0; client->endianTest = 1; |