]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Refactor
authorMukund Sivaraman <muks@isc.org>
Mon, 25 Sep 2017 21:32:09 +0000 (03:02 +0530)
committerMukund Sivaraman <muks@isc.org>
Tue, 26 Sep 2017 09:24:36 +0000 (14:54 +0530)
Reviewed on Jabber by Evan.

bin/named/server.c
bin/nsupdate/nsupdate.c

index eb728cf3509d3803b18a4daa580ef9e2ec3612f5..8361f7c2aed5a83183297187cde6d8cd7aaee030 100644 (file)
@@ -8104,14 +8104,15 @@ load_configuration(const char *filename, named_server_t *server,
         * Write the PID file.
         */
        obj = NULL;
-       if (named_config_get(maps, "pid-file", &obj) == ISC_R_SUCCESS)
+       if (named_config_get(maps, "pid-file", &obj) == ISC_R_SUCCESS) {
                if (cfg_obj_isvoid(obj))
                        named_os_writepidfile(NULL, first_time);
                else
                        named_os_writepidfile(cfg_obj_asstring(obj),
                                              first_time);
-       else
+       } else {
                named_os_writepidfile(named_g_defaultpidfile, first_time);
+       }
 
        /*
         * Configure the server-wide session key.  This must be done before
index 904ea0a66ccabe30a7ec5c24ba5024b8dc873b5b..883ec5d0edec68a77b7e384470cd05ab59dd3d0b 100644 (file)
@@ -903,14 +903,14 @@ setup_system(void) {
                }
        } else {
                isc_sockaddr_t *sa;
-               int i = 0;
+               int i;
 
                /*
                 * Count the nameservers (skipping any that we can't use
                 * because of address family restrictions) and allocate
                 * the servers array.
                 */
-               ns_total = ns_alloc = 0;
+               ns_total = 0;
                for (sa = ISC_LIST_HEAD(*nslist);
                     sa != NULL;
                     sa = ISC_LIST_NEXT(sa, link))
@@ -919,13 +919,11 @@ setup_system(void) {
                        case AF_INET:
                                if (have_ipv4) {
                                        ns_total++;
-                                       continue;
                                }
                                break;
                        case AF_INET6:
                                if (have_ipv6) {
                                        ns_total++;
-                                       continue;
                                }
                                break;
                        default:
@@ -938,22 +936,21 @@ setup_system(void) {
                if (servers == NULL)
                        fatal("out of memory");
 
+               i = 0;
                for (sa = ISC_LIST_HEAD(*nslist);
                     sa != NULL;
                     sa = ISC_LIST_NEXT(sa, link))
                {
                        switch (sa->type.sa.sa_family) {
                        case AF_INET:
-                               if (!have_ipv4) {
-                                       continue;
+                               if (have_ipv4) {
+                                       sa->type.sin.sin_port = htons(dnsport);
                                }
-                               sa->type.sin.sin_port = htons(dnsport);
                                break;
                        case AF_INET6:
-                               if (!have_ipv6) {
-                                       continue;
+                               if (have_ipv6) {
+                                       sa->type.sin6.sin6_port = htons(dnsport);
                                }
-                               sa->type.sin6.sin6_port = htons(dnsport);
                                break;
                        default:
                                fatal("bad family");