From: Kurt Zeilenga Date: Tue, 2 Feb 1999 02:46:18 +0000 (+0000) Subject: Fix idl_firstid to return NOID when !(nids > 1) instead of when (nids == 1) X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~667 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3e48937ac85d61654be7b8a6e77a098477a7b4ff;p=openldap Fix idl_firstid to return NOID when !(nids > 1) instead of when (nids == 1) Fix idl_nextid not to skip an ID if ID not in list. Both of these should not occur if used correctly, but cheap insurance against incorrect usage is welcomed. --- diff --git a/servers/slapd/back-ldbm/idl.c b/servers/slapd/back-ldbm/idl.c index 7df466cb25..10a03ddc14 100644 --- a/servers/slapd/back-ldbm/idl.c +++ b/servers/slapd/back-ldbm/idl.c @@ -932,7 +932,7 @@ idl_firstid( ID_BLOCK *idl ) } if ( ID_BLOCK_ALLIDS( idl ) ) { - return( ID_BLOCK_NIDS(idl) == 1 ? NOID : 1 ); + return( ID_BLOCK_NIDS(idl) > 1 ? 1 : NOID ); } return( ID_BLOCK_ID(idl, 0) ); @@ -947,10 +947,9 @@ idl_nextid( ID_BLOCK *idl, ID id ) return( ++id < ID_BLOCK_NIDS(idl) ? id : NOID ); } - for ( i = 0; i < ID_BLOCK_NIDS(idl) && ID_BLOCK_ID(idl, i) < id; i++ ) { + for ( i = 0; i < ID_BLOCK_NIDS(idl) && ID_BLOCK_ID(idl, i) <= id; i++ ) { ; /* NULL */ } - i++; if ( i >= ID_BLOCK_NIDS(idl) ) { return( NOID );