]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix control flow issues in zone.c
authorEvan Hunt <each@isc.org>
Wed, 2 Nov 2022 12:55:50 +0000 (05:55 -0700)
committerEvan Hunt <each@isc.org>
Wed, 4 Jan 2023 22:14:42 +0000 (14:14 -0800)
Since dns_master_dump() can no longer return DNS_R_CONTINUE,
the error recovery code in synchronous calls to zone_dump() had
branches that could no longer be reached. This has been cleaned
up by using a boolean variable to determine whether the write
is asynchronous rather than depending on the result code.

lib/dns/zone.c

index 1380bb3b701096bee5cc4ee0107d90415bc57811..eab42bf8c0ecdf309f87fde1d00e247e274bb965 100644 (file)
@@ -11942,7 +11942,7 @@ static isc_result_t
 zone_dump(dns_zone_t *zone, bool compact) {
        isc_result_t result;
        dns_dbversion_t *version = NULL;
-       bool again;
+       bool again, async_write = false;
        dns_db_t *db = NULL;
        char *masterfile = NULL;
        dns_masterformat_t masterformat = dns_masterformat_none;
@@ -11984,6 +11984,8 @@ redo:
                                       &zone->writeio);
                if (result != ISC_R_SUCCESS) {
                        zone_idetach(&dummy);
+               } else {
+                       async_write = true;
                }
                UNLOCK_ZONE(zone);
        } else {
@@ -12013,8 +12015,12 @@ fail:
        }
        masterfile = NULL;
 
-       if (result == ISC_R_SUCCESS) {
-               return (ISC_R_SUCCESS); /* XXXMPA */
+       if (async_write) {
+               /*
+                * Asyncronous write is in progress.  Zone flags will get
+                * updated on completion.  Cleanup is complete.  We are done.
+                */
+               return (ISC_R_SUCCESS);
        }
 
        again = false;