]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
4164. [bug] Don't rename slave files and journals on out of memory.
authorMark Andrews <marka@isc.org>
Sun, 12 Jul 2015 23:46:59 +0000 (09:46 +1000)
committerMark Andrews <marka@isc.org>
Sun, 12 Jul 2015 23:49:09 +0000 (09:49 +1000)
                        [RT #40033]

4163.   [bug]           Address compiler warnings. [RT #40024]

(cherry picked from commit 3a49d0ff1000bb74a5f5abaef04f3e41e957c875)

CHANGES
lib/dns/include/dns/rrl.h
lib/dns/rrl.c
lib/dns/update.c
lib/dns/zone.c

diff --git a/CHANGES b/CHANGES
index f10c9ab4478df9599fa55145b73288bb3905ef01..8f2aa3e19c3ef2275e5c54a9b79761cc784a418b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+4164.  [bug]           Don't rename slave files and journals on out of memory.
+                       [RT #40033]
+
+4163.  [bug]           Address compiler warnings. [RT #40024]
+
 4162.  [bug]           httpdmgr->flags was not being initialized. [RT #40017]
 
 4159.  [cleanup]       Alphabetize dig's help output. [RT #39966]
index ef6b72b4280d2bcf105a2d33c13f6b84ab75d479..1f922ab03b89508dd0c4bf75d3645f573df806dc 100644 (file)
@@ -90,16 +90,17 @@ typedef enum {
  */
 #define DNS_RRL_MAX_PREFIX  64
 typedef union dns_rrl_key dns_rrl_key_t;
+struct dns__rrl_key {
+       isc_uint32_t        ip[DNS_RRL_MAX_PREFIX/32];
+       isc_uint32_t        qname_hash;
+       dns_rdatatype_t     qtype;
+       isc_uint8_t         qclass;
+       dns_rrl_rtype_t     rtype   :4; /* 3 bits + sign bit */
+       isc_boolean_t       ipv6    :1;
+};
 union dns_rrl_key {
-       struct {
-               isc_uint32_t        ip[DNS_RRL_MAX_PREFIX/32];
-               isc_uint32_t        qname_hash;
-               dns_rdatatype_t     qtype;
-               isc_uint8_t         qclass;
-               dns_rrl_rtype_t     rtype   :4; /* 3 bits + sign bit */
-               isc_boolean_t       ipv6    :1;
-       } s;
-       isc_uint16_t    w[1];
+       struct dns__rrl_key s;
+       isc_uint16_t    w[sizeof(struct dns__rrl_key)/sizeof(isc_uint16_t)];
 };
 
 /*
index 6124db13bf7b7c8bd7a5a68767633e6ec1932450..0c247e95cf7f620f5f481ef85888484e610aa9d7 100644 (file)
@@ -376,7 +376,7 @@ hash_key(const dns_rrl_key_t *key) {
        int i;
 
        hval = key->w[0];
-       for (i = sizeof(*key) / sizeof(key->w[0]) - 1; i >= 0; --i) {
+       for (i = sizeof(key->w) / sizeof(key->w[0]) - 1; i >= 0; --i) {
                hval = key->w[i] + (hval<<1);
        }
        return (hval);
index 30640b79cdfaa6cd692da34189d5355440cab117..268e25047241f4ef22cf5e5068d42a9a0b9e45d5 100644 (file)
@@ -568,6 +568,7 @@ rrset_visible(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name,
                result = ISC_R_SUCCESS;
                break;
        default:
+               *visible = ISC_FALSE;    /* silence false compiler warning */
                break;
        }
        return (result);
index bcc94aa2292333fb39ed3e92b73f912f45a4ee56..c3878dc5d734b8deb04c50dbadb8a82b5988dae6 100644 (file)
@@ -4370,10 +4370,14 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime,
            zone->type == dns_zone_stub ||
            zone->type == dns_zone_key ||
            (zone->type == dns_zone_redirect && zone->masters != NULL)) {
-               if (zone->journal != NULL)
-                       zone_saveunique(zone, zone->journal, "jn-XXXXXXXX");
-               if (zone->masterfile != NULL)
-                       zone_saveunique(zone, zone->masterfile, "db-XXXXXXXX");
+               if (result != ISC_R_NOMEMORY) {
+                       if (zone->journal != NULL)
+                               zone_saveunique(zone, zone->journal,
+                                               "jn-XXXXXXXX");
+                       if (zone->masterfile != NULL)
+                               zone_saveunique(zone, zone->masterfile,
+                                               "db-XXXXXXXX");
+               }
 
                /* Mark the zone for immediate refresh. */
                zone->refreshtime = now;