Skip to content
Snippets Groups Projects
Commit 7dcb7915 authored by Howard Chu's avatar Howard Chu
Browse files

Fix database search loop conditions

parent d7a1eb0e
No related branches found
No related tags found
No related merge requests found
......@@ -62,7 +62,7 @@ bdb_db_cache(
*dbout = NULL;
for( i=BDB_NDB; bdb->bi_databases[i]; i++ ) {
for( i=BDB_NDB; i < BDB_INDICES && bdb->bi_databases[i]; i++ ) {
if( !strcmp( bdb->bi_databases[i]->bdi_name, name) ) {
*dbout = bdb->bi_databases[i]->bdi_db;
return 0;
......@@ -86,7 +86,7 @@ bdb_db_cache(
if (rc) return rc;
/* check again! may have been added by another thread */
for( i=BDB_NDB; bdb->bi_databases[i]; i++ ) {
for( i=BDB_NDB; i < BDB_INDICES && bdb->bi_databases[i]; i++ ) {
if( !strcmp( bdb->bi_databases[i]->bdi_name, name) ) {
*dbout = bdb->bi_databases[i]->bdi_db;
LOCK_PUT( bdb->bi_dbenv, &lock);
......@@ -152,7 +152,6 @@ bdb_db_cache(
return rc;
}
bdb->bi_databases[i+1] = NULL;
bdb->bi_databases[i] = db;
bdb->bi_ndatabases = i+1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment