]> git.sur5r.net Git - openldap/commitdiff
More for envflags
authorHoward Chu <hyc@openldap.org>
Tue, 25 Sep 2012 11:37:29 +0000 (04:37 -0700)
committerHoward Chu <hyc@openldap.org>
Tue, 25 Sep 2012 11:37:29 +0000 (04:37 -0700)
If trying to alter a non-resettable flag, just close/reopen the env.

servers/slapd/back-mdb/config.c

index 8e7ce671d30cbf4573bda6724f424090287c452e..28c06b2a4ff9d57f34372258a4190171634d2271 100644 (file)
@@ -379,8 +379,11 @@ mdb_cf_gen( ConfigArgs *c )
                                        if ( mdb->mi_dbenv_flags & mdb_envflags[i].mask ) {
                                                /* not all flags are runtime resettable */
                                                rc = mdb_env_set_flags( mdb->mi_dbenv, mdb_envflags[i].mask, 0 );
-                                               if ( rc )
-                                                       break;
+                                               if ( rc ) {
+                                                       mdb->mi_flags |= MDB_RE_OPEN;
+                                                       c->cleanup = mdb_cf_cleanup;
+                                                       rc = 0;
+                                               }
                                                mdb->mi_dbenv_flags ^= mdb_envflags[i].mask;
                                        }
                                }
@@ -388,8 +391,15 @@ mdb_cf_gen( ConfigArgs *c )
                                int i = verb_to_mask( c->line, mdb_envflags );
                                if ( mdb_envflags[i].mask & mdb->mi_dbenv_flags ) {
                                        rc = mdb_env_set_flags( mdb->mi_dbenv, mdb_envflags[i].mask, 0 );
-                                       if ( !rc )
-                                               mdb->mi_dbenv_flags ^= mdb_envflags[i].mask;
+                                       if ( rc ) {
+                                               mdb->mi_flags |= MDB_RE_OPEN;
+                                               c->cleanup = mdb_cf_cleanup;
+                                               rc = 0;
+                                       }
+                                       mdb->mi_dbenv_flags ^= mdb_envflags[i].mask;
+                               } else {
+                                       /* unknown keyword */
+                                       rc = 1;
                                }
                        }
                        break;
@@ -583,10 +593,15 @@ mdb_cf_gen( ConfigArgs *c )
                                        rc = mdb_env_set_flags( mdb->mi_dbenv, mdb_envflags[j].mask, 1 );
                                else
                                        rc = 0;
-                               if ( rc )
-                                       break;
-                               else
-                                       mdb->mi_dbenv_flags |= mdb_envflags[i].mask;
+                               if ( rc ) {
+                                       mdb->mi_flags |= MDB_RE_OPEN;
+                                       c->cleanup = mdb_cf_cleanup;
+                                       rc = 0;
+                               }
+                               mdb->mi_dbenv_flags |= mdb_envflags[i].mask;
+                       } else {
+                               /* unknown keyword */
+                               rc = 1;
                        }
                }
                }