/* txn.c - TP support functions of the bdb2 backend */
+#include "portable.h"
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
#include "txn.h"
fileinfo->dbc_refcnt = 1;
- sprintf( buf, "%s%s%s", li->li_directory, DEFAULT_DIRSEP,
- fileinfo->dbc_name );
+ sprintf( buf, "%s" LDAP_DIRSEP "%s",
+ li->li_directory, fileinfo->dbc_name );
+
if ( stat( buf, &st ) == 0 ) {
fileinfo->dbc_blksize = st.st_blksize;
} else {
if ( open && strcasecmp( fileName, "objectclass" )) {
/* re-use filename to get the complete path */
- sprintf( fileName, "%s%s%s",
- li->li_directory, DEFAULT_DIRSEP, p->dbc_name );
+ sprintf( fileName, "%s" LDAP_DIRSEP "%s",
+ li->li_directory, p->dbc_name );
/* since we have an mpool, we should not define a cache size */
p->dbc_db = bdb2i_db_open( fileName, DB_TYPE,
DB_INFO dbinfo;
char fileName[MAXPATHLEN];
- sprintf( fileName, "%s%s%s",
- li->li_directory, DEFAULT_DIRSEP, NEXTID_NAME );
+ sprintf( fileName, "%s" LDAP_DIRSEP "%s",
+ li->li_directory, NEXTID_NAME );
/* try to open the file for read and write */
memset( &dbinfo, 0, sizeof( dbinfo ));
for ( dbFile = head->dbFiles; dbFile; dbFile = dbFile->next ) {
char fileName[MAXPATHLEN];
- sprintf( fileName, "%s%s%s",
- li->li_directory, DEFAULT_DIRSEP, dbFile->dbc_name );
+ sprintf( fileName, "%s" LDAP_DIRSEP "%s",
+ li->li_directory, dbFile->dbc_name );
/* since we have an mpool, we should not define a cache size */
dbFile->dbc_db = bdb2i_db_open( fileName, DB_TYPE,
}
- ldbm_close( head->nextidFile );
+ if ( head->nextidFile )
+ ldbm_close( head->nextidFile );
}
struct dirent *file;
if ( ( datadir = opendir( li->li_directory ) ) == NULL ) {
+ int err = errno;
Debug( LDAP_DEBUG_ANY,
"bdb2i_check_additional_attr_index(): ERROR while opening datadir: %s\n",
- strerror( errno ), 0, 0 );
+ strerror( err ), 0, 0 );
return( 1 );
}
int rc;
ldbm_datum_init( data );
+ ldbm_datum_free( ldbm, key );
key.flags = data.flags = DB_DBT_MALLOC;
if ( (*dbcp->c_get)( dbcp, &key, &data, DB_NEXT ) == 0 ) {
txn_do_abort = 0;
if (( rc = txn_begin( txmgr, NULL, &txnid )) != 0 ) {
+ int err = errno;
Debug( LDAP_DEBUG_ANY, "bdb2i_start_transction failed: %d: errno=%s\n",
- rc, strerror( errno ), 0 );
+ rc, strerror( err ), 0 );
if ( txnid != NULL )
(void) txn_abort( txnid );
logsize = forced ? (u_int32_t) 0 : txn_max_pending_log;
mins = forced ? (u_int32_t) 0 : txn_max_pending_time;
- slap_set_time();
now = slap_get_time();
rc = txn_checkpoint( txmgr, logsize, mins );