mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-12 10:54:48 +08:00
ITS#7338 fix olcDbConfig changes to take effect immediately
This commit is contained in:
parent
e5864927ae
commit
da75e3b65e
@ -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...
|
||||
|
Loading…
Reference in New Issue
Block a user