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-Tag: OPENLDAP_REL_ENG_2_4_32~51 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bb34b6ab403b502f8f21c9f9e16f46b2a04cac2d;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...