From 848e336db41aea9d3f37f2a06a43d3cc51b8d4df Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 8 Mar 2021 06:53:30 +1100 Subject: [PATCH] Silence CID 329159: Logically dead code in lib/dns/journal.c *** CID 329159: (DEADCODE) /lib/dns/journal.c: 1719 in dns_journal_print() 1713 } 1714 CHECK(dns_difftuple_create( 1715 diff.mctx, n_soa == 1 ? DNS_DIFFOP_DEL : DNS_DIFFOP_ADD, 1716 name, ttl, rdata, &tuple)); 1717 dns_diff_append(&diff, &tuple); 1718 >>> CID 329159: (DEADCODE) >>> Execution cannot reach the expression "printxhdr" inside this statement: "if (++n_put != 0U || printx...". 1719 if (++n_put != 0 || printxhdr) { 1720 result = dns_diff_print(&diff, file); 1721 dns_diff_clear(&diff); 1722 n_put = 0; 1723 if (result != ISC_R_SUCCESS) { 1724 break; /lib/dns/journal.c: 1734 in dns_journal_print() 1728 if (result == ISC_R_NOMORE) { 1729 result = ISC_R_SUCCESS; 1730 } 1731 CHECK(result); 1732 1733 if (!printxhdr && n_put != 0) { >>> CID 329159: (DEADCODE) >>> Execution cannot reach this statement: "result = dns_diff_print(&di...". 1734 result = dns_diff_print(&diff, file); 1735 dns_diff_clear(&diff); 1736 } 1737 goto cleanup; 1738 1739 failure: --- lib/dns/journal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/dns/journal.c b/lib/dns/journal.c index 741da8c294..1b473e4966 100644 --- a/lib/dns/journal.c +++ b/lib/dns/journal.c @@ -1714,7 +1714,7 @@ dns_journal_print(isc_mem_t *mctx, uint32_t flags, const char *filename, name, ttl, rdata, &tuple)); dns_diff_append(&diff, &tuple); - if (++n_put != 0 || printxhdr) { + if (++n_put > 100 || printxhdr) { result = dns_diff_print(&diff, file); dns_diff_clear(&diff); n_put = 0; @@ -1728,7 +1728,7 @@ dns_journal_print(isc_mem_t *mctx, uint32_t flags, const char *filename, } CHECK(result); - if (!printxhdr && n_put != 0) { + if (n_put != 0) { result = dns_diff_print(&diff, file); dns_diff_clear(&diff); }