Subject: Bug#516: [X2Go-Dev] Bug#516: [PATCH 5/5] Replace int with socklen_t and use the correct pointer version in nxtrans Xtranssock.c

From: Mihai Moldovan <[email-masked]>
Date: Sat, 21 Jun 2014 05:30:29 +0200

While the code was working before, I'd still rather use socklen_t instead of int
and not cast its address to void* but rather socklen_t*.

Don't change the SVR4/SCO section, as I have no means of testing that.

This patch is strictly speaking not necessary, but just a tiny bit cleaner
compared to before.
diff --git a/nx-X11/lib/xtrans/Xtranssock.c b/nx-X11/lib/xtrans/Xtranssock.c
index 6103213..091fc1c 100644
--- a/nx-X11/lib/xtrans/Xtranssock.c
+++ b/nx-X11/lib/xtrans/Xtranssock.c
@@ -920,9 +920,11 @@ TRANS(SocketINETGetAddr) (XtransConnInfo ciptr)
     struct sockaddr_in socknamev4;
     void *socknamePtr;
 #if defined(SVR4) || defined(__SCO__)
+#   define SOCKLEN_T_PTR void*
     size_t namelen;
 #else
-    int namelen;
+#   define SOCKLEN_T_PTR socklen_t*
+    socklen_t namelen;
 #endif
 
     PRMSG (3,"SocketINETGetAddr(%p)\n", ciptr, 0, 0);
@@ -941,7 +943,7 @@ TRANS(SocketINETGetAddr) (XtransConnInfo ciptr)
     }
 
     if (getsockname (ciptr->fd,(struct sockaddr *) socknamePtr,
-		     (void *)&namelen) < 0)
+		     (SOCKLEN_T_PTR)&namelen) < 0)
     {
 #ifdef WIN32
 	errno = WSAGetLastError();