]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-bdb2/startup.c
Factor out ldif2* intialization to ldif2common.c
[openldap] / servers / slapd / back-bdb2 / startup.c
index a34974eb59618463c43fe7fd3214d23d6f8c951d..3857ab681248236b7910ffe883fc312bf4a51e18 100644 (file)
@@ -8,11 +8,14 @@
 #include <ac/socket.h>
 #include <ac/unistd.h>
 
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
 #ifdef HAVE_DIRECT_H
 #include <direct.h>
 #endif
 
-#include "ldapconfig.h"
+#include "ldap_defaults.h"
 #include "slap.h"
 #include "back-bdb2.h"
 
@@ -22,7 +25,7 @@ static void remove_old_locks( char *home );
 
 
 static void
-bdb2i_db_errcall( char *prefix, char *message )
+bdb2i_db_errcall( const char *prefix, char *message )
 {
        Debug( LDAP_DEBUG_ANY, "bdb2_db_errcall(): %s %s", prefix, message, 0 );
 }
@@ -45,11 +48,12 @@ bdb2i_back_startup_internal(
                                        DB_INIT_LOCK | DB_INIT_MPOOL );
 
        /*  make sure, dbhome is an absolute path  */
-       if ( *lty->lty_dbhome != *DEFAULT_DIRSEP ) {
+       if ( *lty->lty_dbhome != *LDAP_DIRSEP ) {
                char   cwd[MAXPATHLEN];
 
                (void) getcwd( cwd, MAXPATHLEN );
-               sprintf( cwd, "%s%s%s", cwd, DEFAULT_DIRSEP, lty->lty_dbhome );
+               sprintf( cwd, "%s" LDAP_DIRSEP "%s",
+                       cwd, lty->lty_dbhome );
                free( lty->lty_dbhome );
                lty->lty_dbhome = ch_strdup( cwd );
 
@@ -159,11 +163,13 @@ bdb2i_back_db_startup_internal(
 
        /*  if the data directory is not an absolute path, have it relative
         to the current working directory (which should not be configured !)  */
-       if ( *li->li_directory != *DEFAULT_DIRSEP ) {
+       if ( *li->li_directory != *LDAP_DIRSEP ) {
                char   cwd[MAXPATHLEN];
 
                (void) getcwd( cwd, MAXPATHLEN );
-               sprintf( cwd, "%s%s%s", cwd, DEFAULT_DIRSEP, li->li_directory );
+               sprintf( cwd, "%s" LDAP_DIRSEP "%s",
+                       cwd, li->li_directory );
+
                free( li->li_directory );
                li->li_directory = ch_strdup( cwd );
 
@@ -231,7 +237,7 @@ remove_old_locks( char *home )
        int     err;
 
        memset( &dbEnv, 0, sizeof( DB_ENV ));
-       dbEnv.db_errcall = stderr;
+       dbEnv.db_errcall = bdb2i_db_errcall;
        dbEnv.db_errpfx  = "remove_old_locks(): db_appinit:";
        dbEnv.lk_max     = 0;