From 3a49d0ff1000bb74a5f5abaef04f3e41e957c875 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 13 Jul 2015 09:46:59 +1000 Subject: [PATCH] 4164. [bug] Don't rename slave files and journals on out of memory. [RT #40033] 4163. [bug] Address compiler warnings. [RT #40024] --- CHANGES | 5 +++++ bin/named/config.c | 2 +- lib/dns/include/dns/rrl.h | 19 ++++++++++--------- lib/dns/rrl.c | 2 +- lib/dns/update.c | 1 + lib/dns/zone.c | 12 ++++++++---- 6 files changed, 26 insertions(+), 15 deletions(-) diff --git a/CHANGES b/CHANGES index 0e869e8f78..387d3f517e 100644 --- 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] 4161. [test] Add JSON test for traffic size stats; also test diff --git a/bin/named/config.c b/bin/named/config.c index eb4793a075..d2a428aa05 100644 --- a/bin/named/config.c +++ b/bin/named/config.c @@ -579,7 +579,7 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list, const cfg_obj_t *portobj; const cfg_obj_t *dscpobj; in_port_t port; - isc_dscp_t dscp; + isc_dscp_t dscp = -1; dns_fixedname_t fname; isc_sockaddr_t *addrs = NULL; isc_dscp_t *dscps = NULL; diff --git a/lib/dns/include/dns/rrl.h b/lib/dns/include/dns/rrl.h index ef6b72b428..1f922ab03b 100644 --- a/lib/dns/include/dns/rrl.h +++ b/lib/dns/include/dns/rrl.h @@ -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)]; }; /* diff --git a/lib/dns/rrl.c b/lib/dns/rrl.c index b6200fe96c..d33a1607e7 100644 --- a/lib/dns/rrl.c +++ b/lib/dns/rrl.c @@ -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); diff --git a/lib/dns/update.c b/lib/dns/update.c index 351fe4fdce..052d0f9b12 100644 --- a/lib/dns/update.c +++ b/lib/dns/update.c @@ -569,6 +569,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); diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 0a2d5a2774..a059bd64b7 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -4666,10 +4666,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;