From: Howard Chu Date: Thu, 26 Jul 2012 17:08:18 +0000 (-0700) Subject: ITS#7338 fix olcDbConfig changes to take effect immediately X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=da75e3b65edcb155f738106b1856a58dbf7198ee;p=openldap ITS#7338 fix olcDbConfig changes to take effect immediately --- diff --git a/servers/slapd/back-bdb/config.c b/servers/slapd/back-bdb/config.c index 5d766c7193..85569f3694 100644 --- a/servers/slapd/back-bdb/config.c +++ b/servers/slapd/back-bdb/config.c @@ -324,31 +324,31 @@ bdb_cf_cleanup( ConfigArgs *c ) 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; @@ -556,7 +556,7 @@ bdb_cf_gen( ConfigArgs *c ) 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; @@ -758,7 +758,7 @@ bdb_cf_gen( ConfigArgs *c ) } 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...