]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
fix cppcheck warnings: duplicateCondition
authorMark Andrews <marka@isc.org>
Tue, 1 Oct 2019 07:14:50 +0000 (17:14 +1000)
committerMark Andrews <marka@isc.org>
Tue, 1 Oct 2019 11:28:30 +0000 (21:28 +1000)
bin/named/lwresd.c
bin/named/server.c
lib/dns/acache.c
lib/lwres/getipnode.c
lib/lwres/getnameinfo.c
lib/lwres/lwconfig.c

index 37be6584e3540748c6cd7400fc981b81e33d1ac3..cdc0963884c315b2d61a068e9d1b2a188f23049d 100644 (file)
@@ -207,15 +207,13 @@ ns_lwresd_parseeresolvconf(isc_mem_t *mctx, cfg_parser_t *pctx,
         * Build the search path
         */
        if (lwc->searchnxt > 0) {
-               if (lwc->searchnxt > 0) {
-                       CHECK(buffer_putstr(&b, "\tsearch {\n"));
-                       for (i = 0; i < lwc->searchnxt; i++) {
-                               CHECK(buffer_putstr(&b, "\t\t\""));
-                               CHECK(buffer_putstr(&b, lwc->search[i]));
-                               CHECK(buffer_putstr(&b, "\";\n"));
-                       }
-                       CHECK(buffer_putstr(&b, "\t};\n"));
+               CHECK(buffer_putstr(&b, "\tsearch {\n"));
+               for (i = 0; i < lwc->searchnxt; i++) {
+                       CHECK(buffer_putstr(&b, "\t\t\""));
+                       CHECK(buffer_putstr(&b, lwc->search[i]));
+                       CHECK(buffer_putstr(&b, "\";\n"));
                }
+               CHECK(buffer_putstr(&b, "\t};\n"));
        }
 
        /*
index 040cb3b016546c31080796f59d4596e751370c80..1f48e1547f582a8b8ef0c6ec1ade3657cf565640 100644 (file)
@@ -8245,29 +8245,25 @@ load_configuration(const char *filename, ns_server_t *server,
                        }
 #endif
                }
-       }
 
 #ifdef HAVE_LMDB
-       /*
-        * If we're using LMDB, we may have created newzones databases
-        * as root, making it impossible to reopen them later after
-        * switching to a new userid. We close them now, and reopen
-        * after relinquishing privileges them.
-        */
-       if (first_time) {
+               /*
+                * If we're using LMDB, we may have created newzones
+                * databases as root, making it impossible to reopen
+                * them later after switching to a new userid. We
+                * close them now, and reopen after relinquishing
+                * privileges them.
+                */
                for (view = ISC_LIST_HEAD(server->viewlist);
-                    view != NULL;
-                    view = ISC_LIST_NEXT(view, link))
+                    view != NULL; view = ISC_LIST_NEXT(view, link))
                {
                        nzd_env_close(view);
                }
-       }
 #endif /* HAVE_LMDB */
 
-       /*
-        * Relinquish root privileges.
-        */
-       if (first_time) {
+               /*
+                * Relinquish root privileges.
+                */
                ns_os_changeuser();
        }
 
index 79e7110e1764b0b84f3b50f9ae3b85cfd6aa7aea..fc6973f4cca95db1fab86f918a4c1305642b6902 100644 (file)
@@ -9,8 +9,6 @@
  * information regarding copyright ownership.
  */
 
-/* $Id: acache.c,v 1.22 2008/02/07 23:46:54 tbox Exp $ */
-
 #include <config.h>
 
 #include <isc/atomic.h>
@@ -1597,20 +1595,20 @@ dns_acache_setentry(dns_acache_t *acache, dns_acacheentry_t *entry,
                dns_db_closeversion(db, &version, false);
        /* Set DB node. */
        if (node != NULL) {
+               dns_rdataset_t *ardataset, *crdataset;
+
                INSIST(db != NULL);
                dns_db_attachnode(db, node, &entry->node);
-       }
-
-       /*
-        * Set list of the corresponding rdatasets, if given.
-        * To minimize the overhead and memory consumption, we'll do this for
-        * positive cache only, in which case the DB node is non NULL.
-        * We do not want to cache incomplete information, so give up the
-        * entire entry when a memory shortage happen during the process.
-        */
-       if (node != NULL) {
-               dns_rdataset_t *ardataset, *crdataset;
 
+               /*
+                * Set list of the corresponding rdatasets, if
+                * given. To minimize the overhead and memory
+                * consumption, we'll do this for positive cache
+                * only, in which case the DB node is non NULL.  We
+                * do not want to cache incomplete information, so
+                * give up the entire entry when a memory shortage
+                * happen during the process.
+                */
                entry->foundname = isc_mem_get(acache->mctx,
                                               sizeof(*entry->foundname));
 
index 1d7934f4b72f47b6f39e30b6d4b8794d2de5506e..25b8c62ca8bd50c65ff86a4a921e3ac78070142b 100644 (file)
@@ -9,8 +9,6 @@
  * information regarding copyright ownership.
  */
 
-/* $Id: getipnode.c,v 1.47 2009/09/01 23:47:45 tbox Exp $ */
-
 /*! \file */
 
 /**
@@ -384,11 +382,12 @@ lwres_getipnodebyaddr(const void *src, size_t len, int af, int *error_num) {
                if (af == AF_INET6)
                        cp += 12;
                n = lwres_context_create(&lwrctx, NULL, NULL, NULL, 0);
-               if (n == LWRES_R_SUCCESS)
+               if (n == LWRES_R_SUCCESS) {
                        (void) lwres_conf_parse(lwrctx, lwres_resolv_conf);
-               if (n == LWRES_R_SUCCESS)
+
                        n = lwres_getnamebyaddr(lwrctx, LWRES_ADDRTYPE_V4,
                                                INADDRSZ, cp, &by);
+               }
                if (n != LWRES_R_SUCCESS) {
                        lwres_conf_clear(lwrctx);
                        lwres_context_destroy(&lwrctx);
@@ -428,11 +427,11 @@ lwres_getipnodebyaddr(const void *src, size_t len, int af, int *error_num) {
        }
 
        n = lwres_context_create(&lwrctx, NULL, NULL, NULL, 0);
-       if (n == LWRES_R_SUCCESS)
+       if (n == LWRES_R_SUCCESS) {
                (void) lwres_conf_parse(lwrctx, lwres_resolv_conf);
-       if (n == LWRES_R_SUCCESS)
                n = lwres_getnamebyaddr(lwrctx, LWRES_ADDRTYPE_V6, IN6ADDRSZ,
                                        src, &by);
+       }
        if (n != 0) {
                lwres_conf_clear(lwrctx);
                lwres_context_destroy(&lwrctx);
index 8a02a2a72a7c4f349417ff246ace5a51cd3ff5dc..321ee5c6931b7059d2f8e5e8f717b10d99e2c88d 100644 (file)
@@ -9,8 +9,6 @@
  * information regarding copyright ownership.
  */
 
-/* $Id$ */
-
 /*! \file */
 
 /*
@@ -304,13 +302,13 @@ lwres_getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
                }
 
                n = lwres_context_create(&lwrctx, NULL, NULL, NULL, 0);
-               if (n == 0)
+               if (n == 0) {
                        (void) lwres_conf_parse(lwrctx, lwres_resolv_conf);
 
-               if (n == 0)
                        n = lwres_getnamebyaddr(lwrctx, lwf,
                                                (uint16_t)afd->a_addrlen,
                                                addr, &by);
+               }
                if (n == 0) {
                        if (flags & NI_NOFQDN) {
                                p = strchr(by->realname, '.');
index 36367b2702d2eec6b8c23ec7d792692b88d1863f..ef7c871415ce79a7cf70ab07602c03fee129af22 100644 (file)
@@ -581,8 +581,6 @@ lwres_conf_parseoption(lwres_context_t *ctx,  FILE *fp) {
                        confdata->resdebug = 1;
                } else if (strcmp("no_tld_query", word) == 0) {
                        confdata->no_tld_query = 1;
-               } else if (strcmp("debug", word) == 0) {
-                       confdata->resdebug = 1;
                } else if (strncmp("ndots:", word, 6) == 0) {
                        ndots = strtol(word + 6, &p, 10);
                        if (*p != '\0') /* Bad string. */