CVS: rdesktop configure.ac,1.11,1.12 tcp.c,1.29,1.30

Michael Gernoth <[email protected]>
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23712

Modified Files:
	configure.ac tcp.c 
Log Message:
Real fix for socklen_t


Index: configure.ac
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/configure.ac,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** configure.ac	13 Mar 2005 13:58:23 -0000	1.11
--- configure.ac	31 Mar 2005 10:49:59 -0000	1.12
***************
*** 344,347 ****
--- 344,394 ----
  
  #
+ # socklen_t
+ # from curl
+ 
+ dnl Check for socklen_t: historically on BSD it is an int, and in
+ dnl POSIX 1g it is a type of its own, but some platforms use different
+ dnl types for the argument to getsockopt, getpeername, etc.  So we
+ dnl have to test to find something that will work.
+ AC_DEFUN([TYPE_SOCKLEN_T],
+ [
+    AC_CHECK_TYPE([socklen_t], ,[
+       AC_MSG_CHECKING([for socklen_t equivalent])
+       AC_CACHE_VAL([socklen_t_equiv],
+       [
+          # Systems have either "struct sockaddr *" or
+          # "void *" as the second argument to getpeername
+          socklen_t_equiv=
+          for arg2 in "struct sockaddr" void; do
+             for t in int size_t unsigned long "unsigned long"; do
+                AC_TRY_COMPILE([
+                   #include <sys/types.h>
+                   #include <sys/socket.h>
+ 
+                   int getpeername (int, $arg2 *, $t *);
+                ],[
+                   $t len;
+                   getpeername(0,0,&len);
+                ],[
+                   socklen_t_equiv="$t"
+                   break
+                ])
+             done
+          done
+ 
+          if test "x$socklen_t_equiv" = x; then
+             AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
+          fi
+       ])
+       AC_MSG_RESULT($socklen_t_equiv)
+       AC_DEFINE_UNQUOTED(socklen_t, $socklen_t_equiv,
+ 			[type to use in place of socklen_t if not defined])],
+       [#include <sys/types.h>
+ #include <sys/socket.h>])
+ ])
+ 
+ TYPE_SOCKLEN_T
+ 
+ #
  # IPv6
  #

Index: tcp.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/tcp.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** tcp.c	30 Mar 2005 19:35:42 -0000	1.29
--- tcp.c	31 Mar 2005 10:49:59 -0000	1.30
***************
*** 233,237 ****
  	static char ipaddr[32];
  	struct sockaddr_in sockaddr;
! 	int len = sizeof(sockaddr);
  	if (getsockname(sock, (struct sockaddr *) &sockaddr, &len) == 0)
  	{
--- 233,237 ----
  	static char ipaddr[32];
  	struct sockaddr_in sockaddr;
! 	socklen_t len = sizeof(sockaddr);
  	if (getsockname(sock, (struct sockaddr *) &sockaddr, &len) == 0)
  	{



-------------------------------------------------------
This SF.net email is sponsored by Demarc:
A global provider of Threat Management Solutions.
Download our HomeAdmin security software for free today!
http://www.demarc.com/info/Sentarus/hamr30
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.