[omniORB] Building under GCC2.95.1

Craig Rodrigues rodrigc@mediaone.net
Tue, 14 Sep 1999 23:29:05 -0400


--fUYQa+Pmc3FrFX/N
Content-Type: text/plain; charset=us-ascii

On Tue, Sep 14, 1999 at 08:18:35PM -0600, Robert Simmons Jr. wrote:
> make[5]: Entering directory
> `/root/work/omniORB_280pre2/src/lib/omniORB2/orbcore/gatekeepers/alone'
> gatekeeper.cc: In function `static Boolean
> gateKeeper::checkConnect(tcpSocketStrand *)':
> gatekeeper.cc:124: passing `int *' as argument 3 of `getpeername(int,
> sockaddr *, socklen_t *)' changes signedness
> gatekeeper.cc:141: implicit declaration of function `int
> gethostname(...)'
> make[5]: *** [gatekeeper.o] Error 1
> make[5]: Leaving directory
> `/root/work/omniORB_280pre2/src/lib/omniORB2/orbcore/gatekeepers/alone'

Hi,

I encountered this problem under AIX as well.
The problem is,  the prototype for getpeername() is
not the same on different platforms.

Under Redhat 5.2, with glibc 2.0, the function prototype
for getpeername() is:
int getpeername(int , struct sockaddr *, int *);

With glibc 2.1, the function prototype is now:
int getpeername(int, struct sockaddr *, socklen_t *);
(socklen_t is a typedef for unsigned int in 
/usr/include/socketbits.h)

Under Solaris 2.7, the prototype is:
int getpeername(int, struct sockaddr *, socklen_t *);

Under AIX, the prototype is:
int getpeername(int, struct sockaddr *, size_t *);

I have a patch which works under Linux, AIX, and Solaris,
which I have attached.
-- 
Craig Rodrigues        
http://www.gis.net/~craigr    
rodrigc@mediaone.net          

--fUYQa+Pmc3FrFX/N
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="gatekeeper.cc.patch"

*** gatekeeper.cc	Wed Sep 15 03:21:01 1999
--- gatekeeper.cc.patched	Wed Sep 15 03:23:44 1999
***************
*** 105,111 ****
  	static char gServerDotted[256] = "" ;
  
  	struct sockaddr_in clientAddr ;
! 	int clientAddrSize = sizeof(clientAddr) ;
  	char clientDotted[256] = "" ;
  	char clientName[256] = "" ;
  
--- 105,116 ----
  	static char gServerDotted[256] = "" ;
  
  	struct sockaddr_in clientAddr ;
! #ifdef __aix__
! 	size_t
! #else
! 	socklen_t
! #endif
!                    clientAddrSize = sizeof(clientAddr) ;
  	char clientDotted[256] = "" ;
  	char clientName[256] = "" ;
  

--fUYQa+Pmc3FrFX/N--