summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Cohen Gindi <danielgindi@gmail.com>2014-09-20 16:57:22 +0300
committerDaniel Cohen Gindi <danielgindi@gmail.com>2014-09-20 17:46:32 +0300
commit026c48e7fc13a4a8ada0d686cc2b111043dbc2fa (patch)
treee6b0bfbbb79a93a7feeb1b746b961127a8e336fb
parent7f8520d05c526e1402c69243d0372ca466d1c663 (diff)
downloadlibvncserver-026c48e7fc13a4a8ada0d686cc2b111043dbc2fa.zip
libvncserver-026c48e7fc13a4a8ada0d686cc2b111043dbc2fa.tar.gz
Fixed a violation of the C89 standard ("declarations must come before instructions")
-rw-r--r--libvncserver/httpd.c10
-rw-r--r--libvncserver/rfbserver.c6
-rw-r--r--libvncserver/sockets.c10
3 files changed, 16 insertions, 10 deletions
diff --git a/libvncserver/httpd.c b/libvncserver/httpd.c
index 792a52b..5bac9f9 100644
--- a/libvncserver/httpd.c
+++ b/libvncserver/httpd.c
@@ -392,11 +392,13 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen)
getpeername(rfbScreen->httpSock, (struct sockaddr *)&addr, &addrlen);
#ifdef LIBVNCSERVER_IPv6
- char host[1024];
- if(getnameinfo((struct sockaddr*)&addr, addrlen, host, sizeof(host), NULL, 0, NI_NUMERICHOST) != 0) {
- rfbLogPerror("httpProcessInput: error in getnameinfo");
+ {
+ char host[1024];
+ if(getnameinfo((struct sockaddr*)&addr, addrlen, host, sizeof(host), NULL, 0, NI_NUMERICHOST) != 0) {
+ rfbLogPerror("httpProcessInput: error in getnameinfo");
+ }
+ rfbLog("httpd: get '%s' for %s\n", fname+1, host);
}
- rfbLog("httpd: get '%s' for %s\n", fname+1, host);
#else
rfbLog("httpd: get '%s' for %s\n", fname+1,
inet_ntoa(addr.sin_addr));
diff --git a/libvncserver/rfbserver.c b/libvncserver/rfbserver.c
index 4056318..6972e37 100644
--- a/libvncserver/rfbserver.c
+++ b/libvncserver/rfbserver.c
@@ -320,12 +320,14 @@ rfbNewTCPOrUDPClient(rfbScreenInfoPtr rfbScreen,
if(isUDP) {
rfbLog(" accepted UDP client\n");
- } else {
+ } else {
+#ifdef LIBVNCSERVER_IPv6
+ char host[1024];
+#endif
int one=1;
getpeername(sock, (struct sockaddr *)&addr, &addrlen);
#ifdef LIBVNCSERVER_IPv6
- char host[1024];
if(getnameinfo((struct sockaddr*)&addr, addrlen, host, sizeof(host), NULL, 0, NI_NUMERICHOST) != 0) {
rfbLogPerror("rfbNewClient: error in getnameinfo");
cl->host = strdup("");
diff --git a/libvncserver/sockets.c b/libvncserver/sockets.c
index 6c225e9..31dddd6 100644
--- a/libvncserver/sockets.c
+++ b/libvncserver/sockets.c
@@ -455,11 +455,13 @@ rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen)
#endif
#ifdef LIBVNCSERVER_IPv6
- char host[1024];
- if(getnameinfo((struct sockaddr*)&addr, addrlen, host, sizeof(host), NULL, 0, NI_NUMERICHOST) != 0) {
- rfbLogPerror("rfbProcessNewConnection: error in getnameinfo");
+ {
+ char host[1024];
+ if(getnameinfo((struct sockaddr*)&addr, addrlen, host, sizeof(host), NULL, 0, NI_NUMERICHOST) != 0) {
+ rfbLogPerror("rfbProcessNewConnection: error in getnameinfo");
+ }
+ rfbLog("Got connection from client %s\n", host);
}
- rfbLog("Got connection from client %s\n", host);
#else
rfbLog("Got connection from client %s\n", inet_ntoa(addr.sin_addr));
#endif
OpenPOWER on IntegriCloud