]> git.sur5r.net Git - openldap/commitdiff
ITS#7338 fix olcDbConfig changes to take effect immediately
authorHoward Chu <hyc@openldap.org>
Thu, 26 Jul 2012 17:08:18 +0000 (10:08 -0700)
committerHoward Chu <hyc@openldap.org>
Thu, 26 Jul 2012 17:08:18 +0000 (10:08 -0700)
servers/slapd/back-bdb/config.c

index 5d766c71935be021021c01b3fe8d8432fce57603..85569f36947c0ba91d5ccb4032786b618058d7ad 100644 (file)
@@ -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...