From: Kurt Zeilenga Date: Sat, 17 Apr 1999 03:28:20 +0000 (+0000) Subject: Wrap stat() st_blksize use behind HAVE_ST_BLKSIZE X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~165 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2813272234606b28853a0b22dc91bbf4f2d113d3;p=openldap Wrap stat() st_blksize use behind HAVE_ST_BLKSIZE --- diff --git a/libraries/libldbm/ldbm.c b/libraries/libldbm/ldbm.c index 4a9fbc59f7..678a7e5b3e 100644 --- a/libraries/libldbm/ldbm.c +++ b/libraries/libldbm/ldbm.c @@ -26,6 +26,7 @@ ldbm_datum_free( LDBM ldbm, Datum data ) if ( data.dptr ) { free( data.dptr ); memset( &data, 0, sizeof( Datum )); + data.dptr = NULL; } } @@ -411,7 +412,9 @@ ldbm_errno( LDBM ldbm ) #elif defined( HAVE_GDBM ) +#ifdef HAVE_ST_BLKSIZE #include +#endif /***************************************************************** * * @@ -423,7 +426,6 @@ LDBM ldbm_open( char *name, int rw, int mode, int dbcachesize ) { LDBM db; - struct stat st; LDBM_LOCK; @@ -431,10 +433,17 @@ ldbm_open( char *name, int rw, int mode, int dbcachesize ) LDBM_UNLOCK; return( NULL ); } + +#ifdef HAVE_ST_BLKSIZE if ( dbcachesize > 0 && stat( name, &st ) == 0 ) { + struct stat st; dbcachesize = (dbcachesize / st.st_blksize); gdbm_setopt( db, GDBM_CACHESIZE, &dbcachesize, sizeof(int) ); } +#else + dbcachesize = (dbcachesize / 4096); + gdbm_setopt( db, GDBM_CACHESIZE, &dbcachesize, sizeof(int) ); +#endif LDBM_UNLOCK;