Allow a dbiterator to be restarted (with dns_dbiterator_first()) so long
as an error has not occurred. Have dns_dbiterator_first() return DNS_R_NOMORE if the tree is empty.
This commit is contained in:
@@ -3077,7 +3077,8 @@ dbiterator_first(dns_dbiterator_t *iterator) {
|
|||||||
dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)iterator->db;
|
dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)iterator->db;
|
||||||
dns_name_t *name, *origin;
|
dns_name_t *name, *origin;
|
||||||
|
|
||||||
if (rbtdbiter->result != DNS_R_SUCCESS)
|
if (rbtdbiter->result != DNS_R_SUCCESS &&
|
||||||
|
rbtdbiter->result != DNS_R_NOMORE)
|
||||||
return (rbtdbiter->result);
|
return (rbtdbiter->result);
|
||||||
|
|
||||||
unpause(rbtdbiter);
|
unpause(rbtdbiter);
|
||||||
@@ -3094,18 +3095,22 @@ dbiterator_first(dns_dbiterator_t *iterator) {
|
|||||||
origin);
|
origin);
|
||||||
if (result != DNS_R_NEWORIGIN) {
|
if (result != DNS_R_NEWORIGIN) {
|
||||||
INSIST(result != DNS_R_SUCCESS);
|
INSIST(result != DNS_R_SUCCESS);
|
||||||
rbtdbiter->result = result;
|
if (result == DNS_R_NOTFOUND) {
|
||||||
|
/*
|
||||||
|
* The tree is empty.
|
||||||
|
*/
|
||||||
|
result = DNS_R_NOMORE;
|
||||||
|
}
|
||||||
rbtdbiter->node = NULL;
|
rbtdbiter->node = NULL;
|
||||||
} else {
|
} else {
|
||||||
result = dns_rbtnodechain_current(&rbtdbiter->chain, NULL,
|
result = dns_rbtnodechain_current(&rbtdbiter->chain, NULL,
|
||||||
NULL, &rbtdbiter->node);
|
NULL, &rbtdbiter->node);
|
||||||
if (result == DNS_R_SUCCESS)
|
if (result == DNS_R_SUCCESS)
|
||||||
rbtdbiter->new_origin = ISC_TRUE;
|
rbtdbiter->new_origin = ISC_TRUE;
|
||||||
else {
|
else
|
||||||
rbtdbiter->result = result;
|
|
||||||
rbtdbiter->node = NULL;
|
rbtdbiter->node = NULL;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
rbtdbiter->result = result;
|
||||||
|
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user