struct bdb_info *bdb = c->be->be_private;
int rc = 0;
- if ( bdb->bi_flags & BDB_UPD_CONFIG ) {
- if ( bdb->bi_db_config ) {
- int i;
- FILE *f = fopen( bdb->bi_db_config_path, "w" );
- if ( f ) {
- for (i=0; bdb->bi_db_config[i].bv_val; i++)
- fprintf( f, "%s\n", bdb->bi_db_config[i].bv_val );
- fclose( f );
- }
- } else {
- unlink( bdb->bi_db_config_path );
- }
- bdb->bi_flags ^= BDB_UPD_CONFIG;
- }
-
if ( bdb->bi_flags & BDB_DEL_INDEX ) {
bdb_attr_flush( bdb );
bdb->bi_flags ^= BDB_DEL_INDEX;
}
-
+
if ( bdb->bi_flags & BDB_RE_OPEN ) {
bdb->bi_flags ^= BDB_RE_OPEN;
rc = c->be->bd_info->bi_db_close( c->be, &c->reply );
- if ( rc == 0 )
+ if ( rc == 0 ) {
+ if ( bdb->bi_flags & BDB_UPD_CONFIG ) {
+ if ( bdb->bi_db_config ) {
+ int i;
+ FILE *f = fopen( bdb->bi_db_config_path, "w" );
+ if ( f ) {
+ for (i=0; bdb->bi_db_config[i].bv_val; i++)
+ fprintf( f, "%s\n", bdb->bi_db_config[i].bv_val );
+ fclose( f );
+ }
+ } else {
+ unlink( bdb->bi_db_config_path );
+ }
+ bdb->bi_flags ^= BDB_UPD_CONFIG;
+ }
rc = c->be->bd_info->bi_db_open( c->be, &c->reply );
+ }
/* If this fails, we need to restart */
if ( rc ) {
slapd_shutdown = 2;
for (; bdb->bi_db_config[i].bv_val; i++)
bdb->bi_db_config[i] = bdb->bi_db_config[i+1];
}
- bdb->bi_flags |= BDB_UPD_CONFIG;
+ bdb->bi_flags |= BDB_UPD_CONFIG|BDB_RE_OPEN;
c->cleanup = bdb_cf_cleanup;
break;
/* Doesn't really make sense to change these on the fly;
}
if ( bdb->bi_flags & BDB_IS_OPEN ) {
- bdb->bi_flags |= BDB_UPD_CONFIG;
+ bdb->bi_flags |= BDB_UPD_CONFIG|BDB_RE_OPEN;
c->cleanup = bdb_cf_cleanup;
} else {
/* If we're just starting up...