4654. [cleanup] Don't use C++ keywords delete, new and namespace.

[RT #45538]

(cherry picked from commit 4bf32aa587)
This commit is contained in:
Mark Andrews 2017-07-21 11:52:24 +10:00
parent c722839d70
commit 169bf685a1
33 changed files with 513 additions and 508 deletions

View file

@ -1,3 +1,6 @@
4654. [cleanup] Don't use C++ keywords delete, new and namespace.
[RT #45538]
4652. [bug] Nsupdate could attempt to use a zeroed address on
server timeout. [RT #45417]

View file

@ -2090,10 +2090,10 @@ setup_lookup(dig_lookup_t *lookup) {
check_result(result, "dns_message_gettempname");
dns_name_init(lookup->name, NULL);
isc_buffer_init(&lookup->namebuf, lookup->namespace,
sizeof(lookup->namespace));
isc_buffer_init(&lookup->onamebuf, lookup->onamespace,
sizeof(lookup->onamespace));
isc_buffer_init(&lookup->namebuf, lookup->name_space,
sizeof(lookup->name_space));
isc_buffer_init(&lookup->onamebuf, lookup->oname_space,
sizeof(lookup->oname_space));
#ifdef WITH_IDN
/*

View file

@ -155,8 +155,8 @@ isc_boolean_t sigchase;
dns_rdataclass_t rdclass;
isc_boolean_t rdtypeset;
isc_boolean_t rdclassset;
char namespace[BUFSIZE];
char onamespace[BUFSIZE];
char name_space[BUFSIZE];
char oname_space[BUFSIZE];
isc_buffer_t namebuf;
isc_buffer_t onamebuf;
isc_buffer_t renderbuf;

View file

@ -148,7 +148,7 @@ main(int argc, char **argv) {
char *label = NULL;
dns_ttl_t ttl = 0;
isc_stdtime_t publish = 0, activate = 0, revoke = 0;
isc_stdtime_t inactive = 0, delete = 0;
isc_stdtime_t inactive = 0, deltime = 0;
isc_stdtime_t now;
int prepub = -1;
isc_boolean_t setpub = ISC_FALSE, setact = ISC_FALSE;
@ -278,8 +278,8 @@ main(int argc, char **argv) {
if (setdel || unsetdel)
fatal("-D specified more than once");
delete = strtotime(isc_commandline_argument,
now, now, &setdel);
deltime = strtotime(isc_commandline_argument,
now, now, &setdel);
unsetdel = !setdel;
break;
case 'S':
@ -608,7 +608,7 @@ main(int argc, char **argv) {
dst_key_settime(key, DST_TIME_INACTIVE, inactive);
if (setdel)
dst_key_settime(key, DST_TIME_DELETE, delete);
dst_key_settime(key, DST_TIME_DELETE, deltime);
} else {
if (setpub || setact || setrev || setinact ||
setdel || unsetpub || unsetact ||

View file

@ -233,7 +233,7 @@ main(int argc, char **argv) {
dns_ttl_t ttl = 0;
isc_boolean_t use_default = ISC_FALSE, use_nsec3 = ISC_FALSE;
isc_stdtime_t publish = 0, activate = 0, revokekey = 0;
isc_stdtime_t inactive = 0, delete = 0;
isc_stdtime_t inactive = 0, deltime = 0;
isc_stdtime_t now;
int prepub = -1;
isc_boolean_t setpub = ISC_FALSE, setact = ISC_FALSE;
@ -433,8 +433,8 @@ main(int argc, char **argv) {
if (setdel || unsetdel)
fatal("-D specified more than once");
delete = strtotime(isc_commandline_argument,
now, now, &setdel);
deltime = strtotime(isc_commandline_argument,
now, now, &setdel);
unsetdel = !setdel;
break;
case 'S':
@ -954,13 +954,13 @@ main(int argc, char **argv) {
inactive);
if (setdel) {
if (setinact && delete < inactive)
if (setinact && deltime < inactive)
fprintf(stderr, "%s: warning: Key is "
"scheduled to be deleted "
"before it is scheduled to be "
"made inactive.\n",
program);
dst_key_settime(key, DST_TIME_DELETE, delete);
dst_key_settime(key, DST_TIME_DELETE, deltime);
}
} else {
if (setpub || setact || setrev || setinact ||

View file

@ -576,20 +576,20 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
/* Grow lists? */
if (listcount == l) {
void * new;
void * tmp;
isc_uint32_t newlen = listcount + 16;
size_t newsize, oldsize;
newsize = newlen * sizeof(*lists);
oldsize = listcount * sizeof(*lists);
new = isc_mem_get(mctx, newsize);
if (new == NULL)
tmp = isc_mem_get(mctx, newsize);
if (tmp == NULL)
goto cleanup;
if (listcount != 0) {
memmove(new, lists, oldsize);
memmove(tmp, lists, oldsize);
isc_mem_put(mctx, lists, oldsize);
}
lists = new;
lists = tmp;
listcount = newlen;
}
/* Seen? */
@ -611,20 +611,20 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
lists[l++].name = listname;
/* Grow stack? */
if (stackcount == pushed) {
void * new;
void * tmp;
isc_uint32_t newlen = stackcount + 16;
size_t newsize, oldsize;
newsize = newlen * sizeof(*stack);
oldsize = stackcount * sizeof(*stack);
new = isc_mem_get(mctx, newsize);
if (new == NULL)
tmp = isc_mem_get(mctx, newsize);
if (tmp == NULL)
goto cleanup;
if (stackcount != 0) {
memmove(new, stack, oldsize);
memmove(tmp, stack, oldsize);
isc_mem_put(mctx, stack, oldsize);
}
stack = new;
stack = tmp;
stackcount = newlen;
}
/*
@ -638,32 +638,32 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
}
if (i == addrcount) {
void * new;
void * tmp;
isc_uint32_t newlen = addrcount + 16;
size_t newsize, oldsize;
newsize = newlen * sizeof(isc_sockaddr_t);
oldsize = addrcount * sizeof(isc_sockaddr_t);
new = isc_mem_get(mctx, newsize);
if (new == NULL)
tmp = isc_mem_get(mctx, newsize);
if (tmp == NULL)
goto cleanup;
if (addrcount != 0) {
memmove(new, addrs, oldsize);
memmove(tmp, addrs, oldsize);
isc_mem_put(mctx, addrs, oldsize);
}
addrs = new;
addrs = tmp;
addrcount = newlen;
newsize = newlen * sizeof(dns_name_t *);
oldsize = keycount * sizeof(dns_name_t *);
new = isc_mem_get(mctx, newsize);
if (new == NULL)
tmp = isc_mem_get(mctx, newsize);
if (tmp == NULL)
goto cleanup;
if (keycount != 0) {
memmove(new, keys, oldsize);
memmove(tmp, keys, oldsize);
isc_mem_put(mctx, keys, oldsize);
}
keys = new;
keys = tmp;
keycount = newlen;
}
@ -699,33 +699,33 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
goto resume;
}
if (i < addrcount) {
void * new;
void * tmp;
size_t newsize, oldsize;
newsize = i * sizeof(isc_sockaddr_t);
oldsize = addrcount * sizeof(isc_sockaddr_t);
if (i != 0) {
new = isc_mem_get(mctx, newsize);
if (new == NULL)
tmp = isc_mem_get(mctx, newsize);
if (tmp == NULL)
goto cleanup;
memmove(new, addrs, newsize);
memmove(tmp, addrs, newsize);
} else
new = NULL;
tmp = NULL;
isc_mem_put(mctx, addrs, oldsize);
addrs = new;
addrs = tmp;
addrcount = i;
newsize = i * sizeof(dns_name_t *);
oldsize = keycount * sizeof(dns_name_t *);
if (i != 0) {
new = isc_mem_get(mctx, newsize);
if (new == NULL)
tmp = isc_mem_get(mctx, newsize);
if (tmp == NULL)
goto cleanup;
memmove(new, keys, newsize);
memmove(tmp, keys, newsize);
} else
new = NULL;
tmp = NULL;
isc_mem_put(mctx, keys, oldsize);
keys = new;
keys = tmp;
keycount = i;
}

View file

@ -1245,23 +1245,23 @@ validate_masters(const cfg_obj_t *obj, const cfg_obj_t *config,
}
/* Grow stack? */
if (stackcount == pushed) {
void * new;
void * newstack;
isc_uint32_t newlen = stackcount + 16;
size_t newsize, oldsize;
newsize = newlen * sizeof(*stack);
oldsize = stackcount * sizeof(*stack);
new = isc_mem_get(mctx, newsize);
if (new == NULL)
newstack = isc_mem_get(mctx, newsize);
if (newstack == NULL)
goto cleanup;
if (stackcount != 0) {
void *ptr;
DE_CONST(stack, ptr);
memmove(new, stack, oldsize);
memmove(newstack, stack, oldsize);
isc_mem_put(mctx, ptr, oldsize);
}
stack = new;
stack = newstack;
stackcount = newlen;
}
stack[pushed++] = cfg_list_next(element);

View file

@ -617,7 +617,7 @@ dns_client_destroy(dns_client_t **clientp) {
isc_result_t
dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass,
dns_name_t *namespace, isc_sockaddrlist_t *addrs)
dns_name_t *name_space, isc_sockaddrlist_t *addrs)
{
isc_result_t result;
dns_view_t *view = NULL;
@ -625,8 +625,8 @@ dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass,
REQUIRE(DNS_CLIENT_VALID(client));
REQUIRE(addrs != NULL);
if (namespace == NULL)
namespace = dns_rootname;
if (name_space == NULL)
name_space = dns_rootname;
LOCK(&client->lock);
result = dns_viewlist_find(&client->viewlist, DNS_CLIENTVIEW_NAME,
@ -637,7 +637,7 @@ dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass,
}
UNLOCK(&client->lock);
result = dns_fwdtable_add(view->fwdtable, namespace, addrs,
result = dns_fwdtable_add(view->fwdtable, name_space, addrs,
dns_fwdpolicy_only);
dns_view_detach(&view);
@ -647,15 +647,15 @@ dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass,
isc_result_t
dns_client_clearservers(dns_client_t *client, dns_rdataclass_t rdclass,
dns_name_t *namespace)
dns_name_t *name_space)
{
isc_result_t result;
dns_view_t *view = NULL;
REQUIRE(DNS_CLIENT_VALID(client));
if (namespace == NULL)
namespace = dns_rootname;
if (name_space == NULL)
name_space = dns_rootname;
LOCK(&client->lock);
result = dns_viewlist_find(&client->viewlist, DNS_CLIENTVIEW_NAME,
@ -666,7 +666,7 @@ dns_client_clearservers(dns_client_t *client, dns_rdataclass_t rdclass,
}
UNLOCK(&client->lock);
result = dns_fwdtable_delete(view->fwdtable, namespace);
result = dns_fwdtable_delete(view->fwdtable, name_space);
dns_view_detach(&view);

View file

@ -57,9 +57,9 @@ isc_result_t
dns_dns64_create(isc_mem_t *mctx, isc_netaddr_t *prefix,
unsigned int prefixlen, isc_netaddr_t *suffix,
dns_acl_t *clients, dns_acl_t *mapped, dns_acl_t *excluded,
unsigned int flags, dns_dns64_t **dns64)
unsigned int flags, dns_dns64_t **dns64p)
{
dns_dns64_t *new;
dns_dns64_t *dns64;
unsigned int nbytes = 16;
REQUIRE(prefix != NULL && prefix->family == AF_INET6);
@ -67,7 +67,7 @@ dns_dns64_create(isc_mem_t *mctx, isc_netaddr_t *prefix,
REQUIRE(prefixlen == 32 || prefixlen == 40 || prefixlen == 48 ||
prefixlen == 56 || prefixlen == 64 || prefixlen == 96);
REQUIRE(isc_netaddr_prefixok(prefix, prefixlen) == ISC_R_SUCCESS);
REQUIRE(dns64 != NULL && *dns64 == NULL);
REQUIRE(dns64p != NULL && *dns64p == NULL);
if (suffix != NULL) {
static const unsigned char zeros[16];
@ -79,29 +79,29 @@ dns_dns64_create(isc_mem_t *mctx, isc_netaddr_t *prefix,
REQUIRE(memcmp(suffix->type.in6.s6_addr, zeros, nbytes) == 0);
}
new = isc_mem_get(mctx, sizeof(dns_dns64_t));
if (new == NULL)
dns64 = isc_mem_get(mctx, sizeof(dns_dns64_t));
if (dns64 == NULL)
return (ISC_R_NOMEMORY);
memset(new->bits, 0, sizeof(new->bits));
memmove(new->bits, prefix->type.in6.s6_addr, prefixlen / 8);
memset(dns64->bits, 0, sizeof(dns64->bits));
memmove(dns64->bits, prefix->type.in6.s6_addr, prefixlen / 8);
if (suffix != NULL)
memmove(new->bits + nbytes, suffix->type.in6.s6_addr + nbytes,
memmove(dns64->bits + nbytes, suffix->type.in6.s6_addr + nbytes,
16 - nbytes);
new->clients = NULL;
dns64->clients = NULL;
if (clients != NULL)
dns_acl_attach(clients, &new->clients);
new->mapped = NULL;
dns_acl_attach(clients, &dns64->clients);
dns64->mapped = NULL;
if (mapped != NULL)
dns_acl_attach(mapped, &new->mapped);
new->excluded = NULL;
dns_acl_attach(mapped, &dns64->mapped);
dns64->excluded = NULL;
if (excluded != NULL)
dns_acl_attach(excluded, &new->excluded);
new->prefixlen = prefixlen;
new->flags = flags;
ISC_LINK_INIT(new, link);
new->mctx = NULL;
isc_mem_attach(mctx, &new->mctx);
*dns64 = new;
dns_acl_attach(excluded, &dns64->excluded);
dns64->prefixlen = prefixlen;
dns64->flags = flags;
ISC_LINK_INIT(dns64, link);
dns64->mctx = NULL;
isc_mem_attach(mctx, &dns64->mctx);
*dns64p = dns64;
return (ISC_R_SUCCESS);
}

View file

@ -612,7 +612,7 @@ dns_dnssec_verify(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key,
isc_boolean_t
dns_dnssec_keyactive(dst_key_t *key, isc_stdtime_t now) {
isc_result_t result;
isc_stdtime_t publish, active, revoke, inactive, delete;
isc_stdtime_t publish, active, revoke, inactive, deltime;
isc_boolean_t pubset = ISC_FALSE, actset = ISC_FALSE;
isc_boolean_t revset = ISC_FALSE, inactset = ISC_FALSE;
isc_boolean_t delset = ISC_FALSE;
@ -645,11 +645,11 @@ dns_dnssec_keyactive(dst_key_t *key, isc_stdtime_t now) {
if (result == ISC_R_SUCCESS)
inactset = ISC_TRUE;
result = dst_key_gettime(key, DST_TIME_DELETE, &delete);
result = dst_key_gettime(key, DST_TIME_DELETE, &deltime);
if (result == ISC_R_SUCCESS)
delset = ISC_TRUE;
if ((inactset && inactive <= now) || (delset && delete <= now))
if ((inactset && inactive <= now) || (delset && deltime <= now))
return (ISC_FALSE);
if (revset && revoke <= now && pubset && publish <= now)
@ -1214,7 +1214,7 @@ dns_dnsseckey_destroy(isc_mem_t *mctx, dns_dnsseckey_t **dkp) {
static void
get_hints(dns_dnsseckey_t *key, isc_stdtime_t now) {
isc_result_t result;
isc_stdtime_t publish, active, revoke, inactive, delete;
isc_stdtime_t publish, active, revoke, inactive, deltime;
isc_boolean_t pubset = ISC_FALSE, actset = ISC_FALSE;
isc_boolean_t revset = ISC_FALSE, inactset = ISC_FALSE;
isc_boolean_t delset = ISC_FALSE;
@ -1237,7 +1237,7 @@ get_hints(dns_dnsseckey_t *key, isc_stdtime_t now) {
if (result == ISC_R_SUCCESS)
inactset = ISC_TRUE;
result = dst_key_gettime(key->key, DST_TIME_DELETE, &delete);
result = dst_key_gettime(key->key, DST_TIME_DELETE, &deltime);
if (result == ISC_R_SUCCESS)
delset = ISC_TRUE;
@ -1297,7 +1297,7 @@ get_hints(dns_dnsseckey_t *key, isc_stdtime_t now) {
/*
* Metadata says delete, so don't publish this key or sign with it.
*/
if (delset && delete <= now) {
if (delset && deltime <= now) {
key->hint_publish = ISC_FALSE;
key->hint_sign = ISC_FALSE;
key->hint_remove = ISC_TRUE;

View file

@ -214,22 +214,22 @@ dns_client_destroy(dns_client_t **clientp);
isc_result_t
dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass,
dns_name_t *namespace, isc_sockaddrlist_t *addrs);
dns_name_t *name_space, isc_sockaddrlist_t *addrs);
/*%<
* Specify a list of addresses of recursive name servers that the client will
* use for name resolution. A view for the 'rdclass' class must be created
* beforehand. If 'namespace' is non NULL, the specified server will be used
* if and only if the query name is a subdomain of 'namespace'. When servers
* for multiple 'namespace's are provided, and a query name is covered by
* more than one 'namespace', the servers for the best (longest) matching
* namespace will be used. If 'namespace' is NULL, it works as if
* beforehand. If 'name_space' is non NULL, the specified server will be used
* if and only if the query name is a subdomain of 'name_space'. When servers
* for multiple 'name_space's are provided, and a query name is covered by
* more than one 'name_space', the servers for the best (longest) matching
* name_space will be used. If 'name_space' is NULL, it works as if
* dns_rootname (.) were specified.
*
* Requires:
*
*\li 'client' is a valid client.
*
*\li 'namespace' is NULL or a valid name.
*\li 'name_space' is NULL or a valid name.
*
*\li 'addrs' != NULL.
*
@ -242,17 +242,17 @@ dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass,
isc_result_t
dns_client_clearservers(dns_client_t *client, dns_rdataclass_t rdclass,
dns_name_t *namespace);
dns_name_t *name_space);
/*%<
* Remove configured recursive name servers for the 'rdclass' and 'namespace'
* Remove configured recursive name servers for the 'rdclass' and 'name_space'
* from the client. See the description of dns_client_setservers() for
* the requirements about 'rdclass' and 'namespace'.
* the requirements about 'rdclass' and 'name_space'.
*
* Requires:
*
*\li 'client' is a valid client.
*
*\li 'namespace' is NULL or a valid name.
*\li 'name_space' is NULL or a valid name.
*
* Returns:
*

View file

@ -2100,8 +2100,8 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, isc_uint32_t serial,
unsigned int i;
journal_pos_t best_guess;
journal_pos_t current_pos;
dns_journal_t *j = NULL;
dns_journal_t *new = NULL;
dns_journal_t *j1 = NULL;
dns_journal_t *j2 = NULL;
journal_rawheader_t rawheader;
unsigned int copy_length;
size_t namelen;
@ -2129,22 +2129,22 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, isc_uint32_t serial,
if (result != ISC_R_SUCCESS)
return (result);
result = journal_open(mctx, filename, ISC_FALSE, ISC_FALSE, &j);
result = journal_open(mctx, filename, ISC_FALSE, ISC_FALSE, &j1);
if (result == ISC_R_NOTFOUND) {
is_backup = ISC_TRUE;
result = journal_open(mctx, backup, ISC_FALSE, ISC_FALSE, &j);
result = journal_open(mctx, backup, ISC_FALSE, ISC_FALSE, &j1);
}
if (result != ISC_R_SUCCESS)
return (result);
if (JOURNAL_EMPTY(&j->header)) {
dns_journal_destroy(&j);
if (JOURNAL_EMPTY(&j1->header)) {
dns_journal_destroy(&j1);
return (ISC_R_SUCCESS);
}
if (DNS_SERIAL_GT(j->header.begin.serial, serial) ||
DNS_SERIAL_GT(serial, j->header.end.serial)) {
dns_journal_destroy(&j);
if (DNS_SERIAL_GT(j1->header.begin.serial, serial) ||
DNS_SERIAL_GT(serial, j1->header.end.serial)) {
dns_journal_destroy(&j1);
return (ISC_R_RANGE);
}
@ -2152,19 +2152,19 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, isc_uint32_t serial,
* Cope with very small target sizes.
*/
indexend = sizeof(journal_rawheader_t) +
j->header.index_size * sizeof(journal_rawpos_t);
j1->header.index_size * sizeof(journal_rawpos_t);
if (target_size < indexend * 2)
target_size = target_size/2 + indexend;
/*
* See if there is any work to do.
*/
if ((isc_uint32_t) j->header.end.offset < target_size) {
dns_journal_destroy(&j);
if ((isc_uint32_t) j1->header.end.offset < target_size) {
dns_journal_destroy(&j1);
return (ISC_R_SUCCESS);
}
CHECK(journal_open(mctx, newname, ISC_TRUE, ISC_TRUE, &new));
CHECK(journal_open(mctx, newname, ISC_TRUE, ISC_TRUE, &j2));
/*
* Remove overhead so space test below can succeed.
@ -2175,24 +2175,24 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, isc_uint32_t serial,
/*
* Find if we can create enough free space.
*/
best_guess = j->header.begin;
for (i = 0; i < j->header.index_size; i++) {
if (POS_VALID(j->index[i]) &&
DNS_SERIAL_GE(serial, j->index[i].serial) &&
((isc_uint32_t)(j->header.end.offset - j->index[i].offset)
best_guess = j1->header.begin;
for (i = 0; i < j1->header.index_size; i++) {
if (POS_VALID(j1->index[i]) &&
DNS_SERIAL_GE(serial, j1->index[i].serial) &&
((isc_uint32_t)(j1->header.end.offset - j1->index[i].offset)
>= target_size / 2) &&
j->index[i].offset > best_guess.offset)
best_guess = j->index[i];
j1->index[i].offset > best_guess.offset)
best_guess = j1->index[i];
}
current_pos = best_guess;
while (current_pos.serial != serial) {
CHECK(journal_next(j, &current_pos));
if (current_pos.serial == j->header.end.serial)
CHECK(journal_next(j1, &current_pos));
if (current_pos.serial == j1->header.end.serial)
break;
if (DNS_SERIAL_GE(serial, current_pos.serial) &&
((isc_uint32_t)(j->header.end.offset - current_pos.offset)
((isc_uint32_t)(j1->header.end.offset - current_pos.offset)
>= (target_size / 2)) &&
current_pos.offset > best_guess.offset)
best_guess = current_pos;
@ -2200,16 +2200,16 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, isc_uint32_t serial,
break;
}
INSIST(best_guess.serial != j->header.end.serial);
INSIST(best_guess.serial != j1->header.end.serial);
if (best_guess.serial != serial)
CHECK(journal_next(j, &best_guess));
CHECK(journal_next(j1, &best_guess));
/*
* We should now be roughly half target_size provided
* we did not reach 'serial'. If not we will just copy
* all uncommitted deltas regardless of the size.
*/
copy_length = j->header.end.offset - best_guess.offset;
copy_length = j1->header.end.offset - best_guess.offset;
if (copy_length != 0) {
/*
@ -2224,51 +2224,51 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, isc_uint32_t serial,
goto failure;
}
CHECK(journal_seek(j, best_guess.offset));
CHECK(journal_seek(new, indexend));
CHECK(journal_seek(j1, best_guess.offset));
CHECK(journal_seek(j2, indexend));
for (i = 0; i < copy_length; i += size) {
unsigned int len = (copy_length - i) > size ? size :
(copy_length - i);
CHECK(journal_read(j, buf, len));
CHECK(journal_write(new, buf, len));
CHECK(journal_read(j1, buf, len));
CHECK(journal_write(j2, buf, len));
}
CHECK(journal_fsync(new));
CHECK(journal_fsync(j2));
/*
* Compute new header.
*/
new->header.begin.serial = best_guess.serial;
new->header.begin.offset = indexend;
new->header.end.serial = j->header.end.serial;
new->header.end.offset = indexend + copy_length;
new->header.sourceserial = j->header.sourceserial;
new->header.serialset = j->header.serialset;
j2->header.begin.serial = best_guess.serial;
j2->header.begin.offset = indexend;
j2->header.end.serial = j1->header.end.serial;
j2->header.end.offset = indexend + copy_length;
j2->header.sourceserial = j1->header.sourceserial;
j2->header.serialset = j1->header.serialset;
/*
* Update the journal header.
*/
journal_header_encode(&new->header, &rawheader);
CHECK(journal_seek(new, 0));
CHECK(journal_write(new, &rawheader, sizeof(rawheader)));
CHECK(journal_fsync(new));
journal_header_encode(&j2->header, &rawheader);
CHECK(journal_seek(j2, 0));
CHECK(journal_write(j2, &rawheader, sizeof(rawheader)));
CHECK(journal_fsync(j2));
/*
* Build new index.
*/
current_pos = new->header.begin;
while (current_pos.serial != new->header.end.serial) {
index_add(new, &current_pos);
CHECK(journal_next(new, &current_pos));
current_pos = j2->header.begin;
while (current_pos.serial != j2->header.end.serial) {
index_add(j2, &current_pos);
CHECK(journal_next(j2, &current_pos));
}
/*
* Write index.
*/
CHECK(index_to_disk(new));
CHECK(journal_fsync(new));
CHECK(index_to_disk(j2));
CHECK(journal_fsync(j2));
indexend = new->header.end.offset;
indexend = j2->header.end.offset;
POST(indexend);
}
@ -2276,8 +2276,8 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, isc_uint32_t serial,
* Close both journals before trying to rename files (this is
* necessary on WIN32).
*/
dns_journal_destroy(&j);
dns_journal_destroy(&new);
dns_journal_destroy(&j1);
dns_journal_destroy(&j2);
/*
* With a UFS file system this should just succeed and be atomic.
@ -2314,10 +2314,10 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, isc_uint32_t serial,
(void)isc_file_remove(newname);
if (buf != NULL)
isc_mem_put(mctx, buf, size);
if (j != NULL)
dns_journal_destroy(&j);
if (new != NULL)
dns_journal_destroy(&new);
if (j1 != NULL)
dns_journal_destroy(&j1);
if (j2 != NULL)
dns_journal_destroy(&j2);
return (result);
}

View file

@ -2044,7 +2044,7 @@ static isc_result_t
pushfile(const char *master_file, dns_name_t *origin, dns_loadctx_t *lctx) {
isc_result_t result;
dns_incctx_t *ictx;
dns_incctx_t *new = NULL;
dns_incctx_t *newctx = NULL;
isc_region_t r;
int new_in_use;
@ -2054,40 +2054,40 @@ pushfile(const char *master_file, dns_name_t *origin, dns_loadctx_t *lctx) {
ictx = lctx->inc;
lctx->seen_include = ISC_TRUE;
result = incctx_create(lctx->mctx, origin, &new);
result = incctx_create(lctx->mctx, origin, &newctx);
if (result != ISC_R_SUCCESS)
return (result);
/*
* Push origin_changed.
*/
new->origin_changed = ictx->origin_changed;
newctx->origin_changed = ictx->origin_changed;
/* Set current domain. */
if (ictx->glue != NULL || ictx->current != NULL) {
for (new_in_use = 0; new_in_use < NBUFS; new_in_use++)
if (!new->in_use[new_in_use])
if (!newctx->in_use[new_in_use])
break;
INSIST(new_in_use < NBUFS);
new->current_in_use = new_in_use;
new->current =
dns_fixedname_name(&new->fixed[new->current_in_use]);
new->in_use[new->current_in_use] = ISC_TRUE;
newctx->current_in_use = new_in_use;
newctx->current =
dns_fixedname_name(&newctx->fixed[newctx->current_in_use]);
newctx->in_use[newctx->current_in_use] = ISC_TRUE;
dns_name_toregion((ictx->glue != NULL) ?
ictx->glue : ictx->current, &r);
dns_name_fromregion(new->current, &r);
new->drop = ictx->drop;
dns_name_fromregion(newctx->current, &r);
newctx->drop = ictx->drop;
}
result = (lctx->openfile)(lctx, master_file);
if (result != ISC_R_SUCCESS)
goto cleanup;
new->parent = ictx;
lctx->inc = new;
newctx->parent = ictx;
lctx->inc = newctx;
return (ISC_R_SUCCESS);
cleanup:
incctx_destroy(lctx->mctx, new);
incctx_destroy(lctx->mctx, newctx);
return (result);
}
@ -2761,17 +2761,17 @@ dns_master_loadlexerinc(isc_lex_t *lex, dns_name_t *top,
* Re-link glue and current list.
*/
static dns_rdatalist_t *
grow_rdatalist(int new_len, dns_rdatalist_t *old, int old_len,
grow_rdatalist(int new_len, dns_rdatalist_t *oldlist, int old_len,
rdatalist_head_t *current, rdatalist_head_t *glue,
isc_mem_t *mctx)
{
dns_rdatalist_t *new;
dns_rdatalist_t *newlist;
int rdlcount = 0;
ISC_LIST(dns_rdatalist_t) save;
dns_rdatalist_t *this;
new = isc_mem_get(mctx, new_len * sizeof(*new));
if (new == NULL)
newlist = isc_mem_get(mctx, new_len * sizeof(*newlist));
if (newlist == NULL)
return (NULL);
ISC_LIST_INIT(save);
@ -2782,8 +2782,8 @@ grow_rdatalist(int new_len, dns_rdatalist_t *old, int old_len,
while ((this = ISC_LIST_HEAD(save)) != NULL) {
ISC_LIST_UNLINK(save, this, link);
INSIST(rdlcount < new_len);
new[rdlcount] = *this;
ISC_LIST_APPEND(*current, &new[rdlcount], link);
newlist[rdlcount] = *this;
ISC_LIST_APPEND(*current, &newlist[rdlcount], link);
rdlcount++;
}
@ -2795,15 +2795,15 @@ grow_rdatalist(int new_len, dns_rdatalist_t *old, int old_len,
while ((this = ISC_LIST_HEAD(save)) != NULL) {
ISC_LIST_UNLINK(save, this, link);
INSIST(rdlcount < new_len);
new[rdlcount] = *this;
ISC_LIST_APPEND(*glue, &new[rdlcount], link);
newlist[rdlcount] = *this;
ISC_LIST_APPEND(*glue, &newlist[rdlcount], link);
rdlcount++;
}
INSIST(rdlcount == old_len);
if (old != NULL)
isc_mem_put(mctx, old, old_len * sizeof(*old));
return (new);
if (oldlist != NULL)
isc_mem_put(mctx, oldlist, old_len * sizeof(*oldlist));
return (newlist);
}
/*
@ -2811,20 +2811,20 @@ grow_rdatalist(int new_len, dns_rdatalist_t *old, int old_len,
* Re-link the current and glue chains.
*/
static dns_rdata_t *
grow_rdata(int new_len, dns_rdata_t *old, int old_len,
grow_rdata(int new_len, dns_rdata_t *oldlist, int old_len,
rdatalist_head_t *current, rdatalist_head_t *glue,
isc_mem_t *mctx)
{
dns_rdata_t *new;
dns_rdata_t *newlist;
int rdcount = 0;
ISC_LIST(dns_rdata_t) save;
dns_rdatalist_t *this;
dns_rdata_t *rdata;
new = isc_mem_get(mctx, new_len * sizeof(*new));
if (new == NULL)
newlist = isc_mem_get(mctx, new_len * sizeof(*newlist));
if (newlist == NULL)
return (NULL);
memset(new, 0, new_len * sizeof(*new));
memset(newlist, 0, new_len * sizeof(*newlist));
/*
* Copy current relinking.
@ -2839,8 +2839,8 @@ grow_rdata(int new_len, dns_rdata_t *old, int old_len,
while ((rdata = ISC_LIST_HEAD(save)) != NULL) {
ISC_LIST_UNLINK(save, rdata, link);
INSIST(rdcount < new_len);
new[rdcount] = *rdata;
ISC_LIST_APPEND(this->rdata, &new[rdcount], link);
newlist[rdcount] = *rdata;
ISC_LIST_APPEND(this->rdata, &newlist[rdcount], link);
rdcount++;
}
this = ISC_LIST_NEXT(this, link);
@ -2859,16 +2859,16 @@ grow_rdata(int new_len, dns_rdata_t *old, int old_len,
while ((rdata = ISC_LIST_HEAD(save)) != NULL) {
ISC_LIST_UNLINK(save, rdata, link);
INSIST(rdcount < new_len);
new[rdcount] = *rdata;
ISC_LIST_APPEND(this->rdata, &new[rdcount], link);
newlist[rdcount] = *rdata;
ISC_LIST_APPEND(this->rdata, &newlist[rdcount], link);
rdcount++;
}
this = ISC_LIST_NEXT(this, link);
}
INSIST(rdcount == old_len || rdcount == 0);
if (old != NULL)
isc_mem_put(mctx, old, old_len * sizeof(*old));
return (new);
if (oldlist != NULL)
isc_mem_put(mctx, oldlist, old_len * sizeof(*oldlist));
return (newlist);
}
static isc_uint32_t

View file

@ -383,8 +383,8 @@ match_nsec3param(const dns_rdata_nsec3_t *nsec3,
* change in "diff".
*/
static isc_result_t
delete(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name,
const dns_rdata_nsec3param_t *nsec3param, dns_diff_t *diff)
delnsec3(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name,
const dns_rdata_nsec3param_t *nsec3param, dns_diff_t *diff)
{
dns_dbnode_t *node = NULL ;
dns_difftuple_t *tuple = NULL;
@ -677,7 +677,7 @@ dns_nsec3_addnsec3(dns_db_t *db, dns_dbversion_t *version,
/*
* Delete the old previous NSEC3.
*/
CHECK(delete(db, version, prev, nsec3param, diff));
CHECK(delnsec3(db, version, prev, nsec3param, diff));
/*
* Fixup the previous NSEC3.
@ -713,7 +713,7 @@ dns_nsec3_addnsec3(dns_db_t *db, dns_dbversion_t *version,
/*
* Delete the old NSEC3 and record the change.
*/
CHECK(delete(db, version, hashname, nsec3param, diff));
CHECK(delnsec3(db, version, hashname, nsec3param, diff));
/*
* Add the new NSEC3 and record the change.
*/
@ -796,7 +796,7 @@ dns_nsec3_addnsec3(dns_db_t *db, dns_dbversion_t *version,
/*
* Delete the old previous NSEC3.
*/
CHECK(delete(db, version, prev, nsec3param, diff));
CHECK(delnsec3(db, version, prev, nsec3param, diff));
/*
* Fixup the previous NSEC3.
@ -833,7 +833,7 @@ dns_nsec3_addnsec3(dns_db_t *db, dns_dbversion_t *version,
/*
* Delete the old NSEC3 and record the change.
*/
CHECK(delete(db, version, hashname, nsec3param, diff));
CHECK(delnsec3(db, version, hashname, nsec3param, diff));
/*
* Add the new NSEC3 and record the change.
@ -1403,7 +1403,7 @@ dns_nsec3_delnsec3(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name,
/*
* Delete the old previous NSEC3.
*/
CHECK(delete(db, version, prev, nsec3param, diff));
CHECK(delnsec3(db, version, prev, nsec3param, diff));
/*
* Fixup the previous NSEC3.
@ -1427,7 +1427,7 @@ dns_nsec3_delnsec3(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name,
/*
* Delete the old NSEC3 and record the change.
*/
CHECK(delete(db, version, hashname, nsec3param, diff));
CHECK(delnsec3(db, version, hashname, nsec3param, diff));
/*
* Delete NSEC3 records for now non active nodes.
@ -1503,7 +1503,7 @@ dns_nsec3_delnsec3(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name,
/*
* Delete the old previous NSEC3.
*/
CHECK(delete(db, version, prev, nsec3param, diff));
CHECK(delnsec3(db, version, prev, nsec3param, diff));
/*
* Fixup the previous NSEC3.
@ -1529,7 +1529,7 @@ dns_nsec3_delnsec3(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name,
/*
* Delete the old NSEC3 and record the change.
*/
CHECK(delete(db, version, hashname, nsec3param, diff));
CHECK(delnsec3(db, version, hashname, nsec3param, diff));
} while (1);
success:

View file

@ -307,7 +307,7 @@ dns_private_totext(dns_rdata_t *private, isc_buffer_t *buf) {
unsigned char newbuf[DNS_NSEC3PARAM_BUFFERSIZE];
dns_rdata_t rdata = DNS_RDATA_INIT;
dns_rdata_nsec3param_t nsec3param;
isc_boolean_t delete, init, nonsec;
isc_boolean_t del, init, nonsec;
isc_buffer_t b;
if (!dns_nsec3param_fromprivate(private, &rdata, nsec3buf,
@ -316,7 +316,7 @@ dns_private_totext(dns_rdata_t *private, isc_buffer_t *buf) {
CHECK(dns_rdata_tostruct(&rdata, &nsec3param, NULL));
delete = ISC_TF((nsec3param.flags & DNS_NSEC3FLAG_REMOVE) != 0);
del = ISC_TF((nsec3param.flags & DNS_NSEC3FLAG_REMOVE) != 0);
init = ISC_TF((nsec3param.flags & DNS_NSEC3FLAG_INITIAL) != 0);
nonsec = ISC_TF((nsec3param.flags & DNS_NSEC3FLAG_NONSEC) != 0);
@ -327,7 +327,7 @@ dns_private_totext(dns_rdata_t *private, isc_buffer_t *buf) {
if (init)
isc_buffer_putstr(buf, "Pending NSEC3 chain ");
else if (delete)
else if (del)
isc_buffer_putstr(buf, "Removing NSEC3 chain ");
else
isc_buffer_putstr(buf, "Creating NSEC3 chain ");
@ -340,18 +340,18 @@ dns_private_totext(dns_rdata_t *private, isc_buffer_t *buf) {
CHECK(dns_rdata_totext(&rdata, NULL, buf));
if (delete && !nonsec)
if (del && !nonsec)
isc_buffer_putstr(buf, " / creating NSEC chain");
} else if (private->length == 5) {
unsigned char alg = private->data[0];
dns_keytag_t keyid = (private->data[2] | private->data[1] << 8);
char keybuf[BUFSIZ], algbuf[DNS_SECALG_FORMATSIZE];
isc_boolean_t delete = ISC_TF(private->data[3] != 0);
isc_boolean_t del = ISC_TF(private->data[3] != 0);
isc_boolean_t complete = ISC_TF(private->data[4] != 0);
if (delete && complete)
if (del && complete)
isc_buffer_putstr(buf, "Done removing signatures for ");
else if (delete)
else if (del)
isc_buffer_putstr(buf, "Removing signatures for ");
else if (complete)
isc_buffer_putstr(buf, "Done signing with ");

View file

@ -242,7 +242,7 @@ dns_rbt_addonlevel(dns_rbtnode_t *node, dns_rbtnode_t *current, int order,
dns_rbtnode_t **rootp);
static void
deletefromlevel(dns_rbtnode_t *delete, dns_rbtnode_t **rootp);
deletefromlevel(dns_rbtnode_t *item, dns_rbtnode_t **rootp);
static void
deletetreeflat(dns_rbt_t *rbt, unsigned int quantum, isc_boolean_t unhash,
@ -1810,25 +1810,25 @@ dns_rbt_addonlevel(dns_rbtnode_t *node, dns_rbtnode_t *current, int order,
* true red/black tree on a single level.
*/
static void
deletefromlevel(dns_rbtnode_t *delete, dns_rbtnode_t **rootp) {
deletefromlevel(dns_rbtnode_t *item, dns_rbtnode_t **rootp) {
dns_rbtnode_t *child, *sibling, *parent;
dns_rbtnode_t *successor;
REQUIRE(delete != NULL);
REQUIRE(item != NULL);
/*
* Verify that the parent history is (apparently) correct.
*/
INSIST((IS_ROOT(delete) && *rootp == delete) ||
(! IS_ROOT(delete) &&
(LEFT(PARENT(delete)) == delete ||
RIGHT(PARENT(delete)) == delete)));
INSIST((IS_ROOT(item) && *rootp == item) ||
(! IS_ROOT(item) &&
(LEFT(PARENT(item)) == item ||
RIGHT(PARENT(item)) == item)));
child = NULL;
if (LEFT(delete) == NULL) {
if (RIGHT(delete) == NULL) {
if (IS_ROOT(delete)) {
if (LEFT(item) == NULL) {
if (RIGHT(item) == NULL) {
if (IS_ROOT(item)) {
/*
* This is the only item in the tree.
*/
@ -1839,13 +1839,13 @@ deletefromlevel(dns_rbtnode_t *delete, dns_rbtnode_t **rootp) {
/*
* This node has one child, on the right.
*/
child = RIGHT(delete);
child = RIGHT(item);
} else if (RIGHT(delete) == NULL)
} else if (RIGHT(item) == NULL)
/*
* This node has one child, on the left.
*/
child = LEFT(delete);
child = LEFT(item);
else {
dns_rbtnode_t holder, *tmp = &holder;
@ -1855,7 +1855,7 @@ deletefromlevel(dns_rbtnode_t *delete, dns_rbtnode_t **rootp) {
* move it to this location, then do the deletion at the
* old site of the successor.
*/
successor = RIGHT(delete);
successor = RIGHT(item);
while (LEFT(successor) != NULL)
successor = LEFT(successor);
@ -1883,21 +1883,21 @@ deletefromlevel(dns_rbtnode_t *delete, dns_rbtnode_t **rootp) {
*/
memmove(tmp, successor, sizeof(dns_rbtnode_t));
if (IS_ROOT(delete)) {
if (IS_ROOT(item)) {
*rootp = successor;
successor->is_root = ISC_TRUE;
delete->is_root = ISC_FALSE;
item->is_root = ISC_FALSE;
} else
if (LEFT(PARENT(delete)) == delete)
LEFT(PARENT(delete)) = successor;
if (LEFT(PARENT(item)) == item)
LEFT(PARENT(item)) = successor;
else
RIGHT(PARENT(delete)) = successor;
RIGHT(PARENT(item)) = successor;
PARENT(successor) = PARENT(delete);
LEFT(successor) = LEFT(delete);
RIGHT(successor) = RIGHT(delete);
COLOR(successor) = COLOR(delete);
PARENT(successor) = PARENT(item);
LEFT(successor) = LEFT(item);
RIGHT(successor) = RIGHT(item);
COLOR(successor) = COLOR(item);
if (LEFT(successor) != NULL)
PARENT(LEFT(successor)) = successor;
@ -1909,39 +1909,39 @@ deletefromlevel(dns_rbtnode_t *delete, dns_rbtnode_t **rootp) {
* successor's previous tree location. PARENT(tmp)
* is the successor's original parent.
*/
INSIST(! IS_ROOT(delete));
INSIST(! IS_ROOT(item));
if (PARENT(tmp) == delete) {
if (PARENT(tmp) == item) {
/*
* Node being deleted was successor's parent.
*/
RIGHT(successor) = delete;
PARENT(delete) = successor;
RIGHT(successor) = item;
PARENT(item) = successor;
} else {
LEFT(PARENT(tmp)) = delete;
PARENT(delete) = PARENT(tmp);
LEFT(PARENT(tmp)) = item;
PARENT(item) = PARENT(tmp);
}
/*
* Original location of successor node has no left.
*/
LEFT(delete) = NULL;
RIGHT(delete) = RIGHT(tmp);
COLOR(delete) = COLOR(tmp);
LEFT(item) = NULL;
RIGHT(item) = RIGHT(tmp);
COLOR(item) = COLOR(tmp);
}
/*
* Remove the node by removing the links from its parent.
*/
if (! IS_ROOT(delete)) {
if (LEFT(PARENT(delete)) == delete)
LEFT(PARENT(delete)) = child;
if (! IS_ROOT(item)) {
if (LEFT(PARENT(item)) == item)
LEFT(PARENT(item)) = child;
else
RIGHT(PARENT(delete)) = child;
RIGHT(PARENT(item)) = child;
if (child != NULL)
PARENT(child) = PARENT(delete);
PARENT(child) = PARENT(item);
} else {
/*
@ -1950,14 +1950,14 @@ deletefromlevel(dns_rbtnode_t *delete, dns_rbtnode_t **rootp) {
*/
*rootp = child;
child->is_root = 1;
PARENT(child) = PARENT(delete);
PARENT(child) = PARENT(item);
}
/*
* Fix color violations.
*/
if (IS_BLACK(delete)) {
parent = PARENT(delete);
if (IS_BLACK(item)) {
parent = PARENT(item);
while (child != *rootp && IS_BLACK(child)) {
INSIST(child == NULL || ! IS_ROOT(child));

View file

@ -765,7 +765,7 @@ typedef struct rbtdb_dbiterator {
dns_rbtnodechain_t *current;
dns_rbtnode_t *node;
dns_rbtnode_t *deletions[DELETION_BATCH_MAX];
int delete;
int delcnt;
isc_boolean_t nsec3only;
isc_boolean_t nonsec3;
} rbtdb_dbiterator_t;
@ -946,7 +946,7 @@ adjust_quantum(unsigned int old, isc_time_t *start) {
unsigned int interval;
isc_uint64_t usecs;
isc_time_t end;
unsigned int new;
unsigned int nodes;
if (pps < 100)
pps = 100;
@ -966,20 +966,20 @@ adjust_quantum(unsigned int old, isc_time_t *start) {
old = 1000;
return (old);
}
new = old * interval;
new /= (unsigned int)usecs;
if (new == 0)
new = 1;
else if (new > 1000)
new = 1000;
nodes = old * interval;
nodes /= (unsigned int)usecs;
if (nodes == 0)
nodes = 1;
else if (nodes > 1000)
nodes = 1000;
/* Smooth */
new = (new + old * 3) / 4;
nodes = (nodes + old * 3) / 4;
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_CACHE,
ISC_LOG_DEBUG(1), "adjust_quantum -> %d", new);
ISC_LOG_DEBUG(1), "adjust_quantum -> %d", nodes);
return (new);
return (nodes);
}
static void
@ -5727,7 +5727,7 @@ createiterator(dns_db_t *db, unsigned int options, dns_dbiterator_t **iteratorp)
dns_fixedname_init(&rbtdbiter->name);
dns_fixedname_init(&rbtdbiter->origin);
rbtdbiter->node = NULL;
rbtdbiter->delete = 0;
rbtdbiter->delcnt = 0;
rbtdbiter->nsec3only = ISC_TF((options & DNS_DB_NSEC3ONLY) != 0);
rbtdbiter->nonsec3 = ISC_TF((options & DNS_DB_NONSEC3) != 0);
memset(rbtdbiter->deletions, 0, sizeof(rbtdbiter->deletions));
@ -8693,7 +8693,7 @@ flush_deletions(rbtdb_dbiterator_t *rbtdbiter) {
nodelock_t *lock;
int i;
if (rbtdbiter->delete != 0) {
if (rbtdbiter->delcnt != 0) {
/*
* Note that "%d node of %d in tree" can report things like
* "flush_deletions: 59 nodes of 41 in tree". This means
@ -8703,7 +8703,7 @@ flush_deletions(rbtdb_dbiterator_t *rbtdbiter) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_CACHE, ISC_LOG_DEBUG(1),
"flush_deletions: %d nodes of %d in tree",
rbtdbiter->delete,
rbtdbiter->delcnt,
dns_rbt_nodecount(rbtdb->tree));
if (rbtdbiter->tree_locked == isc_rwlocktype_read) {
@ -8713,7 +8713,7 @@ flush_deletions(rbtdb_dbiterator_t *rbtdbiter) {
RWLOCK(&rbtdb->tree_lock, isc_rwlocktype_write);
rbtdbiter->tree_locked = isc_rwlocktype_write;
for (i = 0; i < rbtdbiter->delete; i++) {
for (i = 0; i < rbtdbiter->delcnt; i++) {
node = rbtdbiter->deletions[i];
lock = &rbtdb->node_locks[node->locknum].lock;
@ -8724,7 +8724,7 @@ flush_deletions(rbtdb_dbiterator_t *rbtdbiter) {
NODE_UNLOCK(lock, isc_rwlocktype_read);
}
rbtdbiter->delete = 0;
rbtdbiter->delcnt = 0;
RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_write);
if (was_read_locked) {
@ -9093,7 +9093,7 @@ dbiterator_current(dns_dbiterator_t *iterator, dns_dbnode_t **nodep,
* to expire the current node. The current node can't
* fully deleted while the iteration cursor is still on it.
*/
if (rbtdbiter->delete == DELETION_BATCH_MAX)
if (rbtdbiter->delcnt == DELETION_BATCH_MAX)
flush_deletions(rbtdbiter);
expire_result = expirenode(iterator->db, *nodep, 0);
@ -9104,7 +9104,7 @@ dbiterator_current(dns_dbiterator_t *iterator, dns_dbnode_t **nodep,
if (expire_result == ISC_R_SUCCESS && node->down == NULL) {
unsigned int refs;
rbtdbiter->deletions[rbtdbiter->delete++] = node;
rbtdbiter->deletions[rbtdbiter->delcnt++] = node;
NODE_STRONGLOCK(&rbtdb->node_locks[node->locknum].lock);
dns_rbtnode_refincrement(node, &refs);
INSIST(refs != 0);

View file

@ -98,7 +98,7 @@ totext_keydata(ARGS_TOTEXT) {
char buf[sizeof("64000")];
unsigned int flags;
unsigned char algorithm;
unsigned long refresh, add, delete;
unsigned long refresh, add, deltime;
char algbuf[DNS_NAME_FORMATSIZE];
const char *keyinfo;
@ -122,9 +122,9 @@ totext_keydata(ARGS_TOTEXT) {
RETERR(str_totext(" ", target));
/* remove hold-down */
delete = uint32_fromregion(&sr);
deltime = uint32_fromregion(&sr);
isc_region_consume(&sr, 4);
RETERR(dns_time32_totext(delete, target));
RETERR(dns_time32_totext(deltime, target));
RETERR(str_totext(" ", target));
/* flags */
@ -224,11 +224,11 @@ totext_keydata(ARGS_TOTEXT) {
RETERR(str_totext(abuf, target));
}
if (delete != 0U) {
if (deltime != 0U) {
RETERR(str_totext(tctx->linebreak, target));
RETERR(str_totext("; removal pending: ",
target));
isc_time_set(&t, delete, 0);
isc_time_set(&t, deltime, 0);
isc_time_formathttptimestamp(&t, dbuf,
sizeof(dbuf));
RETERR(str_totext(dbuf, target));

View file

@ -324,8 +324,8 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
unsigned int headlen;
isc_boolean_t question = ISC_FALSE;
isc_boolean_t shuffle = ISC_FALSE;
dns_rdata_t *shuffled = NULL, shuffled_fixed[MAX_SHUFFLE];
struct towire_sort *sorted = NULL, sorted_fixed[MAX_SHUFFLE];
dns_rdata_t *in = NULL, in_fixed[MAX_SHUFFLE];
struct towire_sort *out = NULL, out_fixed[MAX_SHUFFLE];
UNUSED(state);
@ -372,13 +372,13 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
shuffle = ISC_TRUE;
if (shuffle && count > MAX_SHUFFLE) {
shuffled = isc_mem_get(cctx->mctx, count * sizeof(*shuffled));
sorted = isc_mem_get(cctx->mctx, count * sizeof(*sorted));
if (shuffled == NULL || sorted == NULL)
in = isc_mem_get(cctx->mctx, count * sizeof(*in));
out = isc_mem_get(cctx->mctx, count * sizeof(*out));
if (in == NULL || out == NULL)
shuffle = ISC_FALSE;
} else {
shuffled = shuffled_fixed;
sorted = sorted_fixed;
in = in_fixed;
out = out_fixed;
}
if (shuffle) {
@ -388,8 +388,8 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
i = 0;
do {
INSIST(i < count);
dns_rdata_init(&shuffled[i]);
dns_rdataset_current(rdataset, &shuffled[i]);
dns_rdata_init(&in[i]);
dns_rdataset_current(rdataset, &in[i]);
i++;
result = dns_rdataset_next(rdataset);
} while (result == ISC_R_SUCCESS);
@ -406,9 +406,8 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
*/
INSIST(order != NULL);
for (i = 0; i < count; i++) {
sorted[i].key = (*order)(&shuffled[i],
order_arg);
sorted[i].rdata = &shuffled[i];
out[i].key = (*order)(&in[i], order_arg);
out[i].rdata = &in[i];
}
} else if (WANT_RANDOM(rdataset)) {
/*
@ -419,15 +418,15 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
isc_random_get(&val);
choice = i + (val % (count - i));
rdata = shuffled[i];
shuffled[i] = shuffled[choice];
shuffled[choice] = rdata;
rdata = in[i];
in[i] = in[choice];
in[choice] = rdata;
if (order != NULL)
sorted[i].key = (*order)(&shuffled[i],
order_arg);
out[i].key = (*order)(&in[i],
order_arg);
else
sorted[i].key = 0; /* Unused */
sorted[i].rdata = &shuffled[i];
out[i].key = 0; /* Unused */
out[i].rdata = &in[i];
}
} else {
/*
@ -442,11 +441,11 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
j = val % count;
for (i = 0; i < count; i++) {
if (order != NULL)
sorted[i].key = (*order)(&shuffled[j],
order_arg);
out[i].key = (*order)(&in[j],
order_arg);
else
sorted[i].key = 0; /* Unused */
sorted[i].rdata = &shuffled[j];
out[i].key = 0; /* Unused */
out[i].rdata = &in[j];
j++;
if (j == count)
j = 0; /* Wrap around. */
@ -457,8 +456,7 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
* Sorted order.
*/
if (order != NULL)
qsort(sorted, count, sizeof(sorted[0]),
towire_compare);
qsort(out, count, sizeof(out[0]), towire_compare);
}
savedbuffer = *target;
@ -499,7 +497,7 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
* Copy out the rdata
*/
if (shuffle)
rdata = *(sorted[i].rdata);
rdata = *(out[i].rdata);
else {
dns_rdata_reset(&rdata);
dns_rdataset_current(rdataset, &rdata);
@ -548,10 +546,10 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
*target = savedbuffer;
cleanup:
if (sorted != NULL && sorted != sorted_fixed)
isc_mem_put(cctx->mctx, sorted, count * sizeof(*sorted));
if (shuffled != NULL && shuffled != shuffled_fixed)
isc_mem_put(cctx->mctx, shuffled, count * sizeof(*shuffled));
if (out != NULL && out != out_fixed)
isc_mem_put(cctx->mctx, out, count * sizeof(*out));
if (in != NULL && in != in_fixed)
isc_mem_put(cctx->mctx, in, count * sizeof(*in));
return (result);
}

View file

@ -9425,7 +9425,7 @@ dns_resolver_disable_algorithm(dns_resolver_t *resolver, dns_name_t *name,
unsigned int alg)
{
unsigned int len, mask;
unsigned char *new;
unsigned char *tmp;
unsigned char *algorithms;
isc_result_t result;
dns_rbtnode_t *node = NULL;
@ -9468,18 +9468,18 @@ dns_resolver_disable_algorithm(dns_resolver_t *resolver, dns_name_t *name,
* bitfield and copy the old (smaller) bitfield
* into it if one exists.
*/
new = isc_mem_get(resolver->mctx, len);
if (new == NULL) {
tmp = isc_mem_get(resolver->mctx, len);
if (tmp == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
}
memset(new, 0, len);
memset(tmp, 0, len);
if (algorithms != NULL)
memmove(new, algorithms, *algorithms);
new[len-1] |= mask;
/* new[0] should contain the length of new. */
*new = len;
node->data = new;
memmove(tmp, algorithms, *algorithms);
tmp[len-1] |= mask;
/* 'tmp[0]' should contain the length of 'tmp'. */
*tmp = len;
node->data = tmp;
/* Free the older bitfield. */
if (algorithms != NULL)
isc_mem_put(resolver->mctx, algorithms,

View file

@ -196,18 +196,18 @@ set_age(dns_rrl_t *rrl, dns_rrl_entry_t *e, isc_stdtime_t now) {
}
static isc_result_t
expand_entries(dns_rrl_t *rrl, int new) {
expand_entries(dns_rrl_t *rrl, int newsize) {
unsigned int bsize;
dns_rrl_block_t *b;
dns_rrl_entry_t *e;
double rate;
int i;
if (rrl->num_entries + new >= rrl->max_entries &&
if (rrl->num_entries + newsize >= rrl->max_entries &&
rrl->max_entries != 0)
{
new = rrl->max_entries - rrl->num_entries;
if (new <= 0)
newsize = rrl->max_entries - rrl->num_entries;
if (newsize <= 0)
return (ISC_R_SUCCESS);
}
@ -224,11 +224,11 @@ expand_entries(dns_rrl_t *rrl, int new) {
DNS_LOGMODULE_REQUEST, DNS_RRL_LOG_DROP,
"increase from %d to %d RRL entries with"
" %d bins; average search length %.1f",
rrl->num_entries, rrl->num_entries+new,
rrl->num_entries, rrl->num_entries+newsize,
rrl->hash->length, rate);
}
bsize = sizeof(dns_rrl_block_t) + (new-1)*sizeof(dns_rrl_entry_t);
bsize = sizeof(dns_rrl_block_t) + (newsize-1)*sizeof(dns_rrl_entry_t);
b = isc_mem_get(rrl->mctx, bsize);
if (b == NULL) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_RRL,
@ -241,11 +241,11 @@ expand_entries(dns_rrl_t *rrl, int new) {
b->size = bsize;
e = b->entries;
for (i = 0; i < new; ++i, ++e) {
for (i = 0; i < newsize; ++i, ++e) {
ISC_LINK_INIT(e, hlink);
ISC_LIST_INITANDAPPEND(rrl->lru, e, lru);
}
rrl->num_entries += new;
rrl->num_entries += newsize;
ISC_LIST_INITANDAPPEND(rrl->blocks, b, link);
return (ISC_R_SUCCESS);

View file

@ -41,14 +41,14 @@
#define TEST_ORIGIN "test"
static void
test_create(const atf_tc_t *tc, dns_db_t **old, dns_db_t **new) {
test_create(const atf_tc_t *tc, dns_db_t **old, dns_db_t **newdb) {
isc_result_t result;
result = dns_test_loaddb(old, dns_dbtype_zone, TEST_ORIGIN,
atf_tc_get_md_var(tc, "X-old"));
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = dns_test_loaddb(new, dns_dbtype_zone, TEST_ORIGIN,
result = dns_test_loaddb(newdb, dns_dbtype_zone, TEST_ORIGIN,
atf_tc_get_md_var(tc, "X-new"));
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
}
@ -63,25 +63,25 @@ ATF_TC_HEAD(diffx_same, tc) {
atf_tc_set_md_var(tc, "X-old", "testdata/diff/zone1.data");
atf_tc_set_md_var(tc, "X-new", "testdata/diff/zone1.data"); }
ATF_TC_BODY(diffx_same, tc) {
dns_db_t *new = NULL, *old = NULL;
dns_db_t *newdb = NULL, *olddb = NULL;
isc_result_t result;
dns_diff_t diff;
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
test_create(tc, &old, &new);
test_create(tc, &olddb, &newdb);
dns_diff_init(mctx, &diff);
result = dns_db_diffx(&diff, new, NULL, old, NULL, NULL);
result = dns_db_diffx(&diff, newdb, NULL, olddb, NULL, NULL);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
ATF_REQUIRE_EQ(ISC_LIST_EMPTY(diff.tuples), ISC_TRUE);
dns_diff_clear(&diff);
dns_db_detach(&new);
dns_db_detach(&old);
dns_db_detach(&newdb);
dns_db_detach(&olddb);
dns_test_end();
}
@ -93,7 +93,7 @@ ATF_TC_HEAD(diffx_add, tc) {
atf_tc_set_md_var(tc, "X-new", "testdata/diff/zone2.data");
}
ATF_TC_BODY(diffx_add, tc) {
dns_db_t *new = NULL, *old = NULL;
dns_db_t *newdb = NULL, *olddb = NULL;
dns_difftuple_t *tuple;
isc_result_t result;
dns_diff_t diff;
@ -102,11 +102,11 @@ ATF_TC_BODY(diffx_add, tc) {
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
test_create(tc, &old, &new);
test_create(tc, &olddb, &newdb);
dns_diff_init(mctx, &diff);
result = dns_db_diffx(&diff, new, NULL, old, NULL, NULL);
result = dns_db_diffx(&diff, newdb, NULL, olddb, NULL, NULL);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
ATF_REQUIRE_EQ(ISC_LIST_EMPTY(diff.tuples), ISC_FALSE);
@ -118,8 +118,8 @@ ATF_TC_BODY(diffx_add, tc) {
ATF_REQUIRE_EQ(count, 1);
dns_diff_clear(&diff);
dns_db_detach(&new);
dns_db_detach(&old);
dns_db_detach(&newdb);
dns_db_detach(&olddb);
dns_test_end();
}
@ -131,7 +131,7 @@ ATF_TC_HEAD(diffx_remove, tc) {
atf_tc_set_md_var(tc, "X-new", "testdata/diff/zone3.data");
}
ATF_TC_BODY(diffx_remove, tc) {
dns_db_t *new = NULL, *old = NULL;
dns_db_t *newdb = NULL, *olddb = NULL;
dns_difftuple_t *tuple;
isc_result_t result;
dns_diff_t diff;
@ -140,11 +140,11 @@ ATF_TC_BODY(diffx_remove, tc) {
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
test_create(tc, &old, &new);
test_create(tc, &olddb, &newdb);
dns_diff_init(mctx, &diff);
result = dns_db_diffx(&diff, new, NULL, old, NULL, NULL);
result = dns_db_diffx(&diff, newdb, NULL, olddb, NULL, NULL);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
ATF_REQUIRE_EQ(ISC_LIST_EMPTY(diff.tuples), ISC_FALSE);
@ -156,8 +156,8 @@ ATF_TC_BODY(diffx_remove, tc) {
ATF_REQUIRE_EQ(count, 1);
dns_diff_clear(&diff);
dns_db_detach(&new);
dns_db_detach(&old);
dns_db_detach(&newdb);
dns_db_detach(&olddb);
dns_test_end();
}

View file

@ -58,17 +58,17 @@ ATF_TC_HEAD(increment, tc) {
}
ATF_TC_BODY(increment, tc) {
isc_uint32_t old = 50;
isc_uint32_t new;
isc_uint32_t serial;
isc_result_t result;
UNUSED(tc);
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
new = dns_update_soaserial(old, dns_updatemethod_increment);
ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
ATF_CHECK_MSG(new != 0, "new (%d) should not equal 0", new);
ATF_REQUIRE_EQ(new, 51);
serial = dns_update_soaserial(old, dns_updatemethod_increment);
ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
ATF_CHECK_MSG(serial != 0, "serial (%d) should not equal 0", serial);
ATF_REQUIRE_EQ(serial, 51);
dns_test_end();
}
@ -79,17 +79,17 @@ ATF_TC_HEAD(increment_past_zero, tc) {
}
ATF_TC_BODY(increment_past_zero, tc) {
isc_uint32_t old = 0xffffffffu;
isc_uint32_t new;
isc_uint32_t serial;
isc_result_t result;
UNUSED(tc);
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
new = dns_update_soaserial(old, dns_updatemethod_increment);
ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
ATF_CHECK(new != 0);
ATF_REQUIRE_EQ(new, 1u);
serial = dns_update_soaserial(old, dns_updatemethod_increment);
ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
ATF_CHECK(serial != 0);
ATF_REQUIRE_EQ(serial, 1u);
dns_test_end();
}
@ -99,7 +99,7 @@ ATF_TC_HEAD(past_to_unix, tc) {
}
ATF_TC_BODY(past_to_unix, tc) {
isc_uint32_t old;
isc_uint32_t new;
isc_uint32_t serial;
isc_result_t result;
UNUSED(tc);
@ -109,10 +109,10 @@ ATF_TC_BODY(past_to_unix, tc) {
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
new = dns_update_soaserial(old, dns_updatemethod_unixtime);
ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
ATF_CHECK(new != 0);
ATF_REQUIRE_EQ(new, mystdtime);
serial = dns_update_soaserial(old, dns_updatemethod_unixtime);
ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
ATF_CHECK(serial != 0);
ATF_REQUIRE_EQ(serial, mystdtime);
dns_test_end();
}
@ -122,7 +122,7 @@ ATF_TC_HEAD(now_to_unix, tc) {
}
ATF_TC_BODY(now_to_unix, tc) {
isc_uint32_t old;
isc_uint32_t new;
isc_uint32_t serial;
isc_result_t result;
UNUSED(tc);
@ -132,10 +132,10 @@ ATF_TC_BODY(now_to_unix, tc) {
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
new = dns_update_soaserial(old, dns_updatemethod_unixtime);
ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
ATF_CHECK(new != 0);
ATF_REQUIRE_EQ(new, old+1);
serial = dns_update_soaserial(old, dns_updatemethod_unixtime);
ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
ATF_CHECK(serial != 0);
ATF_REQUIRE_EQ(serial, old + 1);
dns_test_end();
}
@ -145,7 +145,7 @@ ATF_TC_HEAD(future_to_unix, tc) {
}
ATF_TC_BODY(future_to_unix, tc) {
isc_uint32_t old;
isc_uint32_t new;
isc_uint32_t serial;
isc_result_t result;
UNUSED(tc);
@ -155,10 +155,10 @@ ATF_TC_BODY(future_to_unix, tc) {
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
new = dns_update_soaserial(old, dns_updatemethod_unixtime);
ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
ATF_CHECK(new != 0);
ATF_REQUIRE_EQ(new, old+1);
serial = dns_update_soaserial(old, dns_updatemethod_unixtime);
ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
ATF_CHECK(serial != 0);
ATF_REQUIRE_EQ(serial, old + 1);
dns_test_end();
}
@ -168,7 +168,7 @@ ATF_TC_HEAD(undefined_plus1_to_unix, tc) {
}
ATF_TC_BODY(undefined_plus1_to_unix, tc) {
isc_uint32_t old;
isc_uint32_t new;
isc_uint32_t serial;
isc_result_t result;
UNUSED(tc);
@ -179,10 +179,10 @@ ATF_TC_BODY(undefined_plus1_to_unix, tc) {
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
new = dns_update_soaserial(old, dns_updatemethod_unixtime);
ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
ATF_CHECK(new != 0);
ATF_REQUIRE_EQ(new, mystdtime);
serial = dns_update_soaserial(old, dns_updatemethod_unixtime);
ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
ATF_CHECK(serial != 0);
ATF_REQUIRE_EQ(serial, mystdtime);
dns_test_end();
}
@ -192,7 +192,7 @@ ATF_TC_HEAD(undefined_minus1_to_unix, tc) {
}
ATF_TC_BODY(undefined_minus1_to_unix, tc) {
isc_uint32_t old;
isc_uint32_t new;
isc_uint32_t serial;
isc_result_t result;
UNUSED(tc);
@ -203,10 +203,10 @@ ATF_TC_BODY(undefined_minus1_to_unix, tc) {
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
new = dns_update_soaserial(old, dns_updatemethod_unixtime);
ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
ATF_CHECK(new != 0);
ATF_REQUIRE_EQ(new, old+1);
serial = dns_update_soaserial(old, dns_updatemethod_unixtime);
ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
ATF_CHECK(serial != 0);
ATF_REQUIRE_EQ(serial, old + 1);
dns_test_end();
}
@ -216,7 +216,7 @@ ATF_TC_HEAD(undefined_to_unix, tc) {
}
ATF_TC_BODY(undefined_to_unix, tc) {
isc_uint32_t old;
isc_uint32_t new;
isc_uint32_t serial;
isc_result_t result;
UNUSED(tc);
@ -226,10 +226,10 @@ ATF_TC_BODY(undefined_to_unix, tc) {
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
new = dns_update_soaserial(old, dns_updatemethod_unixtime);
ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
ATF_CHECK(new != 0);
ATF_REQUIRE_EQ(new, old+1);
serial = dns_update_soaserial(old, dns_updatemethod_unixtime);
ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
ATF_CHECK(serial != 0);
ATF_REQUIRE_EQ(serial, old + 1);
dns_test_end();
}
@ -239,7 +239,7 @@ ATF_TC_HEAD(unixtime_zero, tc) {
}
ATF_TC_BODY(unixtime_zero, tc) {
isc_uint32_t old;
isc_uint32_t new;
isc_uint32_t serial;
isc_result_t result;
UNUSED(tc);
@ -249,10 +249,10 @@ ATF_TC_BODY(unixtime_zero, tc) {
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
new = dns_update_soaserial(old, dns_updatemethod_unixtime);
ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
ATF_CHECK(new != 0);
ATF_REQUIRE_EQ(new, old+1);
serial = dns_update_soaserial(old, dns_updatemethod_unixtime);
ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
ATF_CHECK(serial != 0);
ATF_REQUIRE_EQ(serial, old + 1);
dns_test_end();
}

View file

@ -1638,7 +1638,7 @@ dns_view_flushnode(dns_view_t *view, dns_name_t *name, isc_boolean_t tree) {
isc_result_t
dns_view_adddelegationonly(dns_view_t *view, dns_name_t *name) {
isc_result_t result;
dns_name_t *new;
dns_name_t *item;
isc_uint32_t hash;
REQUIRE(DNS_VIEW_VALID(view));
@ -1653,27 +1653,27 @@ dns_view_adddelegationonly(dns_view_t *view, dns_name_t *name) {
ISC_LIST_INIT(view->delonly[hash]);
}
hash = dns_name_hash(name, ISC_FALSE) % DNS_VIEW_DELONLYHASH;
new = ISC_LIST_HEAD(view->delonly[hash]);
while (new != NULL && !dns_name_equal(new, name))
new = ISC_LIST_NEXT(new, link);
if (new != NULL)
item = ISC_LIST_HEAD(view->delonly[hash]);
while (item != NULL && !dns_name_equal(item, name))
item = ISC_LIST_NEXT(item, link);
if (item != NULL)
return (ISC_R_SUCCESS);
new = isc_mem_get(view->mctx, sizeof(*new));
if (new == NULL)
item = isc_mem_get(view->mctx, sizeof(*item));
if (item == NULL)
return (ISC_R_NOMEMORY);
dns_name_init(new, NULL);
result = dns_name_dup(name, view->mctx, new);
dns_name_init(item, NULL);
result = dns_name_dup(name, view->mctx, item);
if (result == ISC_R_SUCCESS)
ISC_LIST_APPEND(view->delonly[hash], new, link);
ISC_LIST_APPEND(view->delonly[hash], item, link);
else
isc_mem_put(view->mctx, new, sizeof(*new));
isc_mem_put(view->mctx, item, sizeof(*item));
return (result);
}
isc_result_t
dns_view_excludedelegationonly(dns_view_t *view, dns_name_t *name) {
isc_result_t result;
dns_name_t *new;
dns_name_t *item;
isc_uint32_t hash;
REQUIRE(DNS_VIEW_VALID(view));
@ -1688,26 +1688,26 @@ dns_view_excludedelegationonly(dns_view_t *view, dns_name_t *name) {
ISC_LIST_INIT(view->rootexclude[hash]);
}
hash = dns_name_hash(name, ISC_FALSE) % DNS_VIEW_DELONLYHASH;
new = ISC_LIST_HEAD(view->rootexclude[hash]);
while (new != NULL && !dns_name_equal(new, name))
new = ISC_LIST_NEXT(new, link);
if (new != NULL)
item = ISC_LIST_HEAD(view->rootexclude[hash]);
while (item != NULL && !dns_name_equal(item, name))
item = ISC_LIST_NEXT(item, link);
if (item != NULL)
return (ISC_R_SUCCESS);
new = isc_mem_get(view->mctx, sizeof(*new));
if (new == NULL)
item = isc_mem_get(view->mctx, sizeof(*item));
if (item == NULL)
return (ISC_R_NOMEMORY);
dns_name_init(new, NULL);
result = dns_name_dup(name, view->mctx, new);
dns_name_init(item, NULL);
result = dns_name_dup(name, view->mctx, item);
if (result == ISC_R_SUCCESS)
ISC_LIST_APPEND(view->rootexclude[hash], new, link);
ISC_LIST_APPEND(view->rootexclude[hash], item, link);
else
isc_mem_put(view->mctx, new, sizeof(*new));
isc_mem_put(view->mctx, item, sizeof(*item));
return (result);
}
isc_boolean_t
dns_view_isdelegationonly(dns_view_t *view, dns_name_t *name) {
dns_name_t *new;
dns_name_t *item;
isc_uint32_t hash;
REQUIRE(DNS_VIEW_VALID(view));
@ -1719,20 +1719,20 @@ dns_view_isdelegationonly(dns_view_t *view, dns_name_t *name) {
if (view->rootdelonly && dns_name_countlabels(name) <= 2) {
if (view->rootexclude == NULL)
return (ISC_TRUE);
new = ISC_LIST_HEAD(view->rootexclude[hash]);
while (new != NULL && !dns_name_equal(new, name))
new = ISC_LIST_NEXT(new, link);
if (new == NULL)
item = ISC_LIST_HEAD(view->rootexclude[hash]);
while (item != NULL && !dns_name_equal(item, name))
item = ISC_LIST_NEXT(item, link);
if (item == NULL)
return (ISC_TRUE);
}
if (view->delonly == NULL)
return (ISC_FALSE);
new = ISC_LIST_HEAD(view->delonly[hash]);
while (new != NULL && !dns_name_equal(new, name))
new = ISC_LIST_NEXT(new, link);
if (new == NULL)
item = ISC_LIST_HEAD(view->delonly[hash]);
while (item != NULL && !dns_name_equal(item, name))
item = ISC_LIST_NEXT(item, link);
if (item == NULL)
return (ISC_FALSE);
return (ISC_TRUE);
}

View file

@ -619,7 +619,7 @@ struct dns_signing {
dns_dbiterator_t *dbiterator;
dns_secalg_t algorithm;
isc_uint16_t keyid;
isc_boolean_t delete;
isc_boolean_t deleteit;
isc_boolean_t done;
ISC_LINK(dns_signing_t) link;
};
@ -774,7 +774,7 @@ static void zone_maintenance(dns_zone_t *zone);
static void zone_notify(dns_zone_t *zone, isc_time_t *now);
static void dump_done(void *arg, isc_result_t result);
static isc_result_t zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm,
isc_uint16_t keyid, isc_boolean_t delete);
isc_uint16_t keyid, isc_boolean_t deleteit);
static isc_result_t delete_nsec(dns_db_t *db, dns_dbversion_t *ver,
dns_dbnode_t *node, dns_name_t *name,
dns_diff_t *diff);
@ -1318,9 +1318,10 @@ dns_zone_getdbtype(dns_zone_t *zone, char ***argv, isc_mem_t *mctx) {
isc_result_t
dns_zone_setdbtype(dns_zone_t *zone,
unsigned int dbargc, const char * const *dbargv) {
unsigned int dbargc, const char * const *dbargv)
{
isc_result_t result = ISC_R_SUCCESS;
char **new = NULL;
char **argv = NULL;
unsigned int i;
REQUIRE(DNS_ZONE_VALID(zone));
@ -1330,14 +1331,14 @@ dns_zone_setdbtype(dns_zone_t *zone,
LOCK_ZONE(zone);
/* Set up a new database argument list. */
new = isc_mem_get(zone->mctx, dbargc * sizeof(*new));
if (new == NULL)
argv = isc_mem_get(zone->mctx, dbargc * sizeof(*argv));
if (argv == NULL)
goto nomem;
for (i = 0; i < dbargc; i++)
new[i] = NULL;
argv[i] = NULL;
for (i = 0; i < dbargc; i++) {
new[i] = isc_mem_strdup(zone->mctx, dbargv[i]);
if (new[i] == NULL)
argv[i] = isc_mem_strdup(zone->mctx, dbargv[i]);
if (argv[i] == NULL)
goto nomem;
}
@ -1345,16 +1346,16 @@ dns_zone_setdbtype(dns_zone_t *zone,
zone_freedbargs(zone);
zone->db_argc = dbargc;
zone->db_argv = new;
zone->db_argv = argv;
result = ISC_R_SUCCESS;
goto unlock;
nomem:
if (new != NULL) {
if (argv != NULL) {
for (i = 0; i < dbargc; i++)
if (new[i] != NULL)
isc_mem_free(zone->mctx, new[i]);
isc_mem_put(zone->mctx, new, dbargc * sizeof(*new));
if (argv[i] != NULL)
isc_mem_free(zone->mctx, argv[i]);
isc_mem_put(zone->mctx, argv, dbargc * sizeof(*argv));
}
result = ISC_R_NOMEMORY;
@ -5007,31 +5008,33 @@ dns_zone_getnotifysrc6(dns_zone_t *zone) {
}
static isc_boolean_t
same_addrs(const isc_sockaddr_t *old, const isc_sockaddr_t *new,
isc_uint32_t count)
same_addrs(isc_sockaddr_t const *oldlist, isc_sockaddr_t const *newlist,
isc_uint32_t count)
{
unsigned int i;
for (i = 0; i < count; i++)
if (!isc_sockaddr_equal(&old[i], &new[i]))
if (!isc_sockaddr_equal(&oldlist[i], &newlist[i]))
return (ISC_FALSE);
return (ISC_TRUE);
}
static isc_boolean_t
same_keynames(dns_name_t **old, dns_name_t **new, isc_uint32_t count) {
same_keynames(dns_name_t * const *oldlist, dns_name_t * const *newlist,
isc_uint32_t count)
{
unsigned int i;
if (old == NULL && new == NULL)
if (oldlist == NULL && newlist == NULL)
return (ISC_TRUE);
if (old == NULL || new == NULL)
if (oldlist == NULL || newlist == NULL)
return (ISC_FALSE);
for (i = 0; i < count; i++) {
if (old[i] == NULL && new[i] == NULL)
if (oldlist[i] == NULL && newlist[i] == NULL)
continue;
if (old[i] == NULL || new[i] == NULL ||
!dns_name_equal(old[i], new[i]))
if (oldlist[i] == NULL || newlist[i] == NULL ||
!dns_name_equal(oldlist[i], newlist[i]))
return (ISC_FALSE);
}
return (ISC_TRUE);
@ -6258,17 +6261,17 @@ updatesignwithkey(dns_zone_t *zone, dns_signing_t *signing,
continue;
}
/*
* We have a match. If we were signing (!signing->delete)
* We have a match. If we were signing (!signing->deleteit)
* and we already have a record indicating that we have
* finished signing (rdata.data[4] != 0) then keep it.
* Otherwise it needs to be deleted as we have removed all
* the signatures (signing->delete), so any record indicating
* the signatures (signing->deleteit), so any record indicating
* completion is now out of date, or we have finished signing
* with the new record so we no longer need to remember that
* we need to sign the zone with the matching key across a
* nameserver re-start.
*/
if (!signing->delete && rdata.data[4] != 0) {
if (!signing->deleteit && rdata.data[4] != 0) {
seen_done = ISC_TRUE;
have_rr = ISC_TRUE;
} else
@ -6279,7 +6282,7 @@ updatesignwithkey(dns_zone_t *zone, dns_signing_t *signing,
}
if (result == ISC_R_NOMORE)
result = ISC_R_SUCCESS;
if (!signing->delete && !seen_done) {
if (!signing->deleteit && !seen_done) {
/*
* If we were signing then we need to indicate that we have
* finished signing the zone with this key. If it is already
@ -7646,7 +7649,7 @@ zone_sign(dns_zone_t *zone) {
delegation = ISC_FALSE;
if (first && signing->delete) {
if (first && signing->deleteit) {
/*
* Remove the key we are deleting from consideration.
*/
@ -7669,7 +7672,7 @@ zone_sign(dns_zone_t *zone) {
dns_dbiterator_current(signing->dbiterator, &node, name);
if (signing->delete) {
if (signing->deleteit) {
dns_dbiterator_pause(signing->dbiterator);
CHECK(del_sig(db, version, name, node, nkeys,
signing->algorithm, signing->keyid,
@ -7718,7 +7721,7 @@ zone_sign(dns_zone_t *zone) {
/*
* When adding look for the specific key.
*/
if (!signing->delete &&
if (!signing->deleteit &&
(dst_key_alg(zone_keys[i]) != signing->algorithm ||
dst_key_id(zone_keys[i]) != signing->keyid))
continue;
@ -7727,7 +7730,7 @@ zone_sign(dns_zone_t *zone) {
* When deleting make sure we are properly signed
* with the algorithm that was being removed.
*/
if (signing->delete &&
if (signing->deleteit &&
ALG(zone_keys[i]) != signing->algorithm)
continue;
@ -7774,7 +7777,7 @@ zone_sign(dns_zone_t *zone) {
* If we are adding we are done. Look for other keys
* of the same algorithm if deleting.
*/
if (!signing->delete)
if (!signing->deleteit)
break;
}
@ -10177,7 +10180,7 @@ notify_send(dns_notify_t *notify) {
dns_adbaddrinfo_t *ai;
isc_sockaddr_t dst;
isc_result_t result;
dns_notify_t *new = NULL;
dns_notify_t *newnotify = NULL;
unsigned int flags;
isc_boolean_t startup;
@ -10199,24 +10202,24 @@ notify_send(dns_notify_t *notify) {
continue;
if (notify_isself(notify->zone, &dst))
continue;
new = NULL;
newnotify = NULL;
flags = notify->flags & DNS_NOTIFY_NOSOA;
result = notify_create(notify->mctx, flags, &new);
result = notify_create(notify->mctx, flags, &newnotify);
if (result != ISC_R_SUCCESS)
goto cleanup;
zone_iattach(notify->zone, &new->zone);
ISC_LIST_APPEND(new->zone->notifies, new, link);
new->dst = dst;
zone_iattach(notify->zone, &newnotify->zone);
ISC_LIST_APPEND(newnotify->zone->notifies, newnotify, link);
newnotify->dst = dst;
startup = ISC_TF((notify->flags & DNS_NOTIFY_STARTUP) != 0);
result = notify_send_queue(new, startup);
result = notify_send_queue(newnotify, startup);
if (result != ISC_R_SUCCESS)
goto cleanup;
new = NULL;
newnotify = NULL;
}
cleanup:
if (new != NULL)
notify_destroy(new, ISC_TRUE);
if (newnotify != NULL)
notify_destroy(newnotify, ISC_TRUE);
}
void
@ -16209,7 +16212,7 @@ dns_zone_getnotifydelay(dns_zone_t *zone) {
isc_result_t
dns_zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm,
isc_uint16_t keyid, isc_boolean_t delete)
isc_uint16_t keyid, isc_boolean_t deleteit)
{
isc_result_t result;
REQUIRE(DNS_ZONE_VALID(zone));
@ -16218,7 +16221,7 @@ dns_zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm,
"dns_zone_signwithkey(algorithm=%u, keyid=%u)",
algorithm, keyid);
LOCK_ZONE(zone);
result = zone_signwithkey(zone, algorithm, keyid, delete);
result = zone_signwithkey(zone, algorithm, keyid, deleteit);
UNLOCK_ZONE(zone);
return (result);
@ -16298,7 +16301,7 @@ dns_zone_getprivatetype(dns_zone_t *zone) {
static isc_result_t
zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm, isc_uint16_t keyid,
isc_boolean_t delete)
isc_boolean_t deleteit)
{
dns_signing_t *signing;
dns_signing_t *current;
@ -16315,7 +16318,7 @@ zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm, isc_uint16_t keyid,
signing->dbiterator = NULL;
signing->algorithm = algorithm;
signing->keyid = keyid;
signing->delete = delete;
signing->deleteit = deleteit;
signing->done = ISC_FALSE;
TIME_NOW(&now);
@ -16338,7 +16341,7 @@ zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm, isc_uint16_t keyid,
if (current->db == signing->db &&
current->algorithm == signing->algorithm &&
current->keyid == signing->keyid) {
if (current->delete != signing->delete)
if (current->deleteit != signing->deleteit)
current->done = ISC_TRUE;
else
goto cleanup;

View file

@ -174,7 +174,7 @@ set_key(dns_client_t *client, char *keynamestr, char *keystr,
static void
addserver(dns_client_t *client, const char *addrstr, const char *port,
const char *namespace)
const char *name_space)
{
struct addrinfo hints, *res;
int gaierror;
@ -205,9 +205,9 @@ addserver(dns_client_t *client, const char *addrstr, const char *port,
ISC_LIST_INIT(servers);
ISC_LIST_APPEND(servers, &sa, link);
if (namespace != NULL) {
namelen = strlen(namespace);
isc_buffer_constinit(&b, namespace, namelen);
if (name_space != NULL) {
namelen = strlen(name_space);
isc_buffer_constinit(&b, name_space, namelen);
isc_buffer_add(&b, namelen);
dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);

View file

@ -91,14 +91,14 @@ inet_pton4(const char *src, unsigned char *dst) {
const char *pch;
if ((pch = strchr(digits, ch)) != NULL) {
unsigned int new = *tp * 10;
unsigned int byte = *tp * 10;
new += (int)(pch - digits);
byte += (int)(pch - digits);
if (saw_digit && *tp == 0)
return (0);
if (new > 255)
if (byte > 255)
return (0);
*tp = new;
*tp = byte;
if (!saw_digit) {
if (++octets > 4)
return (0);

View file

@ -71,17 +71,17 @@ struct isc_lex {
static inline isc_result_t
grow_data(isc_lex_t *lex, size_t *remainingp, char **currp, char **prevp) {
char *new;
char *tmp;
new = isc_mem_get(lex->mctx, lex->max_token * 2 + 1);
if (new == NULL)
tmp = isc_mem_get(lex->mctx, lex->max_token * 2 + 1);
if (tmp == NULL)
return (ISC_R_NOMEMORY);
memmove(new, lex->data, lex->max_token + 1);
*currp = new + (*currp - lex->data);
memmove(tmp, lex->data, lex->max_token + 1);
*currp = tmp + (*currp - lex->data);
if (*prevp != NULL)
*prevp = new + (*prevp - lex->data);
*prevp = tmp + (*prevp - lex->data);
isc_mem_put(lex->mctx, lex->data, lex->max_token + 1);
lex->data = new;
lex->data = tmp;
*remainingp += lex->max_token;
lex->max_token *= 2;
return (ISC_R_SUCCESS);

View file

@ -1541,7 +1541,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
* Check for duplicates.
*/
if (write_once) {
isc_logmessage_t *message, *new;
isc_logmessage_t *message, *next;
isc_time_t oldest;
isc_interval_t interval;
@ -1554,7 +1554,8 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
* range.
*/
TIME_NOW(&oldest);
if (isc_time_subtract(&oldest, &interval, &oldest)
if (isc_time_subtract(&oldest, &interval,
&oldest)
!= ISC_R_SUCCESS)
/*
* Can't effectively do the checking
@ -1562,7 +1563,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
*/
message = NULL;
else
message =ISC_LIST_HEAD(lctx->messages);
message = ISC_LIST_HEAD(lctx->messages);
while (message != NULL) {
if (isc_time_compare(&message->time,
@ -1579,8 +1580,8 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
* message to spring back into
* existence.
*/
new = ISC_LIST_NEXT(message,
link);
next = ISC_LIST_NEXT(message,
link);
ISC_LIST_UNLINK(lctx->messages,
message, link);
@ -1590,7 +1591,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
sizeof(*message) + 1 +
strlen(message->text));
message = new;
message = next;
continue;
}
@ -1616,22 +1617,22 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
* It wasn't in the duplicate interval,
* so add it to the message list.
*/
new = isc_mem_get(lctx->mctx,
sizeof(isc_logmessage_t) +
strlen(lctx->buffer) + 1);
if (new != NULL) {
message = isc_mem_get(lctx->mctx,
sizeof(isc_logmessage_t) +
strlen(lctx->buffer) + 1);
if (message != NULL) {
/*
* Put the text immediately after
* the struct. The strcpy is safe.
*/
new->text = (char *)(new + 1);
strcpy(new->text, lctx->buffer);
message->text = (char *)(message + 1);
strcpy(message->text, lctx->buffer);
TIME_NOW(&new->time);
TIME_NOW(&message->time);
ISC_LINK_INIT(new, link);
ISC_LINK_INIT(message, link);
ISC_LIST_APPEND(lctx->messages,
new, link);
message, link);
}
}
}

View file

@ -527,7 +527,7 @@ quantize(size_t size) {
static inline isc_boolean_t
more_basic_blocks(isc__mem_t *ctx) {
void *new;
void *tmp;
unsigned char *curr, *next;
unsigned char *first, *last;
unsigned char **table;
@ -563,16 +563,16 @@ more_basic_blocks(isc__mem_t *ctx) {
ctx->basic_table_size = table_size;
}
new = (ctx->memalloc)(ctx->arg, NUM_BASIC_BLOCKS * ctx->mem_target);
if (new == NULL) {
tmp = (ctx->memalloc)(ctx->arg, NUM_BASIC_BLOCKS * ctx->mem_target);
if (tmp == NULL) {
ctx->memalloc_failures++;
return (ISC_FALSE);
}
ctx->total += increment;
ctx->basic_table[ctx->basic_table_count] = new;
ctx->basic_table[ctx->basic_table_count] = tmp;
ctx->basic_table_count++;
curr = new;
curr = tmp;
next = curr + ctx->mem_target;
for (i = 0; i < (NUM_BASIC_BLOCKS - 1); i++) {
((element *)curr)->next = (element *)next;
@ -584,13 +584,13 @@ more_basic_blocks(isc__mem_t *ctx) {
* array.
*/
((element *)curr)->next = NULL;
first = new;
first = tmp;
last = first + NUM_BASIC_BLOCKS * ctx->mem_target - 1;
if (first < ctx->lowest || ctx->lowest == NULL)
ctx->lowest = first;
if (last > ctx->highest)
ctx->highest = last;
ctx->basic_blocks = new;
ctx->basic_blocks = tmp;
return (ISC_TRUE);
}
@ -599,7 +599,7 @@ static inline isc_boolean_t
more_frags(isc__mem_t *ctx, size_t new_size) {
int i, frags;
size_t total_size;
void *new;
void *tmp;
unsigned char *curr, *next;
/*!
@ -620,7 +620,7 @@ more_frags(isc__mem_t *ctx, size_t new_size) {
}
total_size = ctx->mem_target;
new = ctx->basic_blocks;
tmp = ctx->basic_blocks;
ctx->basic_blocks = ctx->basic_blocks->next;
frags = (int)(total_size / new_size);
ctx->stats[new_size].blocks++;
@ -629,7 +629,7 @@ more_frags(isc__mem_t *ctx, size_t new_size) {
* Set up a linked-list of blocks of size
* "new_size".
*/
curr = new;
curr = tmp;
next = curr + new_size;
total_size -= new_size;
for (i = 0; i < (frags - 1); i++) {
@ -652,7 +652,7 @@ more_frags(isc__mem_t *ctx, size_t new_size) {
* array.
*/
((element *)curr)->next = NULL;
ctx->freelists[new_size] = new;
ctx->freelists[new_size] = tmp;
return (ISC_TRUE);
}

View file

@ -78,7 +78,7 @@ static inline int
#else
static int
#endif
isc_atomic_cmpxchg(atomic_p p, int old, int new) {
isc_atomic_cmpxchg(atomic_p p, int old, int replacement) {
int orig = old;
#ifdef __GNUC__
@ -86,7 +86,7 @@ isc_atomic_cmpxchg(atomic_p p, int old, int new) {
#else
__isync();
#endif
if (compare_and_swap(p, &orig, new))
if (compare_and_swap(p, &orig, replacement))
orig = old;
#ifdef __GNUC__

View file

@ -2376,20 +2376,20 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock,
*/
if (manager->reserved != 0 && sock->type == isc_sockettype_udp &&
sock->fd >= 0 && sock->fd < manager->reserved) {
int new, tmp;
new = fcntl(sock->fd, F_DUPFD, manager->reserved);
int newfd, tmp;
newfd = fcntl(sock->fd, F_DUPFD, manager->reserved);
tmp = errno;
(void)close(sock->fd);
errno = tmp;
sock->fd = new;
sock->fd = newfd;
err = "isc_socket_create: fcntl/reserved";
} else if (sock->fd >= 0 && sock->fd < 20) {
int new, tmp;
new = fcntl(sock->fd, F_DUPFD, 20);
int newfd, tmp;
newfd = fcntl(sock->fd, F_DUPFD, 20);
tmp = errno;
(void)close(sock->fd);
errno = tmp;
sock->fd = new;
sock->fd = newfd;
err = "isc_socket_create: fcntl";
}
#endif
@ -3245,12 +3245,12 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
* Leave a space for stdio to work in.
*/
if (fd >= 0 && fd < 20) {
int new, tmp;
new = fcntl(fd, F_DUPFD, 20);
int newfd, tmp;
newfd = fcntl(fd, F_DUPFD, 20);
tmp = errno;
(void)close(fd);
errno = tmp;
fd = new;
fd = newfd;
err = "accept/fcntl";
}
#endif

View file

@ -90,12 +90,12 @@ inet_pton4(const char *src, unsigned char *dst) {
const char *pch;
if ((pch = strchr(digits, ch)) != NULL) {
unsigned int new = *tp * 10;
unsigned int byte = *tp * 10;
new += (unsigned int)(pch - digits);
if (new > 255)
byte += (unsigned int)(pch - digits);
if (byte > 255)
return (0);
*tp = new;
*tp = byte;
if (! saw_digit) {
if (++octets > 4)
return (0);