Check for the correct return code of cursor->c_get() (DB_BUFFER_SMALL)

This commit is contained in:
Ralf Haferkamp 2006-09-27 10:51:06 +00:00
parent b769f44619
commit e1f068f712
2 changed files with 3 additions and 2 deletions

View file

@ -130,6 +130,7 @@ int bdb_id2entry(
rc = cursor->c_get( cursor, &key, &data, DB_SET ); rc = cursor->c_get( cursor, &key, &data, DB_SET );
if ( rc ) goto leave; if ( rc ) goto leave;
eh.bv.bv_val = buf; eh.bv.bv_val = buf;
eh.bv.bv_len = data.size; eh.bv.bv_len = data.size;
rc = entry_header( &eh ); rc = entry_header( &eh );
@ -139,7 +140,7 @@ int bdb_id2entry(
data.flags ^= DB_DBT_PARTIAL; data.flags ^= DB_DBT_PARTIAL;
data.ulen = 0; data.ulen = 0;
rc = cursor->c_get( cursor, &key, &data, DB_CURRENT ); rc = cursor->c_get( cursor, &key, &data, DB_CURRENT );
if ( rc != ENOMEM ) goto leave; if ( rc != DB_BUFFER_SMALL ) goto leave;
/* Allocate a block and retrieve the data */ /* Allocate a block and retrieve the data */
off = eh.data - eh.bv.bv_val; off = eh.data - eh.bv.bv_val;

View file

@ -273,7 +273,7 @@ Entry* bdb_tool_entry_get( BackendDB *be, ID id )
data.flags ^= DB_DBT_PARTIAL; data.flags ^= DB_DBT_PARTIAL;
data.ulen = 0; data.ulen = 0;
rc = cursor->c_get( cursor, &key, &data, DB_CURRENT ); rc = cursor->c_get( cursor, &key, &data, DB_CURRENT );
if ( rc != ENOMEM ) goto leave; if ( rc != DB_BUFFER_SMALL ) goto leave;
/* Allocate a block and retrieve the data */ /* Allocate a block and retrieve the data */
eh.bv.bv_len = eh.nvals * sizeof( struct berval ) + data.size; eh.bv.bv_len = eh.nvals * sizeof( struct berval ) + data.size;