From: Evan Hunt Date: Sat, 22 Mar 2025 06:48:01 +0000 (-0700) Subject: import_rdataset() can't fail X-Git-Tag: v9.21.9~37^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a6ef103dd0e703b3e8ad7568d5c2e1bfa138d51;p=thirdparty%2Fbind9.git import_rdataset() can't fail the import_rdataset() function can't return any value other than ISC_R_SUCCESS, so it's been changed to void and its callers don't rely on its return value any longer. --- diff --git a/lib/dns/adb.c b/lib/dns/adb.c index bef3694d64a..f2c7925f6b2 100644 --- a/lib/dns/adb.c +++ b/lib/dns/adb.c @@ -538,10 +538,9 @@ ttlclamp(dns_ttl_t ttl) { * * This code handles A and AAAA rdatasets only. */ -static isc_result_t +static void import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset, isc_stdtime_t now) { - isc_result_t result; dns_adb_t *adb = NULL; dns_rdatatype_t rdtype; @@ -569,8 +568,8 @@ import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset, REQUIRE(dns_rdatatype_isaddr(rdtype)); - for (result = dns_rdataset_first(rdataset); result == ISC_R_SUCCESS; - result = dns_rdataset_next(rdataset)) + for (isc_result_t result = dns_rdataset_first(rdataset); + result == ISC_R_SUCCESS; result = dns_rdataset_next(rdataset)) { /* FIXME: Move to a separate function */ dns_adbnamehooklist_t *hookhead = NULL; @@ -616,10 +615,6 @@ import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset, UNLOCK(&entry->lock); dns_adbentry_detach(&entry); } - if (result == ISC_R_NOMORE) { - result = ISC_R_SUCCESS; - } - INSIST(result == ISC_R_SUCCESS); switch (rdtype) { case dns_rdatatype_a: @@ -637,8 +632,6 @@ import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset, default: UNREACHABLE(); } - - return ISC_R_SUCCESS; } static bool @@ -2532,6 +2525,8 @@ dbfind_name(dns_adbname_t *adbname, isc_stdtime_t now, dns_rdatatype_t rdtype) { switch (result) { case DNS_R_GLUE: case DNS_R_HINT: + result = ISC_R_SUCCESS; + FALLTHROUGH; case ISC_R_SUCCESS: /* * Found in the database. Even if we can't copy out @@ -2543,7 +2538,7 @@ dbfind_name(dns_adbname_t *adbname, isc_stdtime_t now, dns_rdatatype_t rdtype) { } else { adbname->fetch6_err = FIND_ERR_SUCCESS; } - result = import_rdataset(adbname, &rdataset, now); + import_rdataset(adbname, &rdataset, now); break; case DNS_R_NXDOMAIN: case DNS_R_NXRRSET: @@ -2645,7 +2640,6 @@ fetch_callback(void *arg) { dns_adbfetch_t *fetch = NULL; dns_adbstatus_t astat = DNS_ADB_NOMOREADDRESSES; isc_stdtime_t now; - isc_result_t result; unsigned int address_type; REQUIRE(DNS_ADBNAME_VALID(name)); @@ -2734,11 +2728,10 @@ fetch_callback(void *arg) { */ if (resp->result == DNS_R_CNAME || resp->result == DNS_R_DNAME) { resp->rdataset->ttl = ttlclamp(resp->rdataset->ttl); - result = ISC_R_SUCCESS; name->flags |= NAME_IS_ALIAS; name->expire_v4 = name->expire_v6 = ADJUSTED_EXPIRE(INT_MAX, now, resp->rdataset->ttl); - goto check_result; + goto moreaddrs; } /* @@ -2775,16 +2768,14 @@ fetch_callback(void *arg) { /* * We got something potentially useful. */ - result = import_rdataset(name, &fetch->rdataset, now); + import_rdataset(name, &fetch->rdataset, now); -check_result: - if (result == ISC_R_SUCCESS) { - astat = DNS_ADB_MOREADDRESSES; - if (address_type == DNS_ADBFIND_INET) { - name->fetch_err = FIND_ERR_SUCCESS; - } else { - name->fetch6_err = FIND_ERR_SUCCESS; - } +moreaddrs: + astat = DNS_ADB_MOREADDRESSES; + if (address_type == DNS_ADBFIND_INET) { + name->fetch_err = FIND_ERR_SUCCESS; + } else { + name->fetch6_err = FIND_ERR_SUCCESS; } out: