[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#3614) Portability problems on Solaris10 amd64



Full_Name: George Kodinov
Version: openldap-stable-20050318
OS: Solaris 10/AMD64
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (213.91.243.4)


ldap_bind_s fails with a GPF if the library is compiled in the Solaris 10 64 bit
mode (using the Sun Studio 10 and the '-xtarget=opteron -xarch=amd64').

This is caused by the fact that the sysconf () (3C) API is defined as 
long sysconf(int name),

but it's return value : long (8 bytes on this platform) is assigned to an int (4
bytes on this platform).

Here's a small diff to fix that :
--- openldap-2.2.24/libraries/libldap/os-ip.c   2005-01-31 17:53:39.000000000
+0200
+++ openldap-2.2.24.my/libraries/libldap/os-ip.c        2005-03-30
18:34:59.000000000 +0300
@@ -712,7 +712,7 @@
 void
 ldap_int_ip_init( void )
 {
-       int tblsize;
+       long tblsize;
 #if defined( HAVE_SYSCONF )
        tblsize = sysconf( _SC_OPEN_MAX );
 #elif defined( HAVE_GETDTABLESIZE )
@@ -725,6 +725,8 @@
        if( tblsize > FD_SETSIZE )
                tblsize = FD_SETSIZE;
 #endif /* FD_SETSIZE*/
+       if ( tblsize > INT_MAX)
+               tblsize = INT_MAX;
        ldap_int_tblsize = tblsize;
 }