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

Mihai Moldovan ionic at ionic.de
Sat Jun 21 05:30:29 CEST 2014


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.
-------------- next part --------------
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();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4265 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.x2go.org/pipermail/x2go-dev/attachments/20140621/e102f900/attachment.bin>


More information about the x2go-dev mailing list