Commit a4cb3332 authored by Lubos Slovak's avatar Lubos Slovak

Fixed return value checking in some places.

parent 51aff428
......@@ -1830,7 +1830,7 @@ int zones_process_update(knot_nameserver_t *nameserver,
knot_packet_free(&resp);
rcu_read_unlock();
return KNOT_EOK;
return ret;
}
/*----------------------------------------------------------------------------*/
......
......@@ -1762,7 +1762,9 @@ static inline int ns_referral(const knot_node_t *node,
&closest_encloser,
qname, resp);
} else if (ret != KNOT_EOK) {
}
if (ret != KNOT_EOK) {
return ret;
}
......@@ -1889,6 +1891,9 @@ static int ns_answer_from_node(const knot_node_t *node,
if (answers == 0) { // if NODATA response, put SOA
ret = ns_put_authority_soa(zone, resp);
if (ret != KNOT_EOK) {
return ret;
}
if (knot_node_rrset_count(node) == 0
&& !knot_zone_contents_nsec3_enabled(zone)) {
// node is an empty non-terminal => NSEC for NXDOMAIN
......@@ -2341,7 +2346,6 @@ finalize:
if (ret == KNOT_ESPACE) {
knot_response_set_rcode(resp, KNOT_RCODE_NOERROR);
ret = KNOT_EOK;
}
// add all missing NSECs/NSEC3s for wildcard nodes
......
......@@ -995,8 +995,12 @@ static int knot_ddns_add_rr(knot_node_t *node, const knot_rrset_t *rr,
* This code is more or less copied from xfr-in.c.
*/
knot_rrset_t *node_rrset_copy = NULL;
ret = xfrin_copy_rrset(node, rr->type, &node_rrset_copy, changes,
0);
ret = xfrin_copy_rrset(node, rr->type, &node_rrset_copy, changes, 0);
if (ret < 0) {
  • OK, but unusual. if (ret != KNOT_EOK)

  • It's because the function may return 1 if there was no such RRSet in the node. But that has not to be considered an error - such case is handled below (if (node_rrset_copy == NULL) ...)

Please register or sign in to reply
dbg_ddns("Failed to copy RRSet: %s\n", knot_strerror(ret));
knot_rrset_deep_free(rr_copy, 1);
return ret;
}
if (node_rrset_copy == NULL) {
/* No such RRSet in the node. Add the whole UPDATE RRSet. */
......
......@@ -2010,10 +2010,14 @@ static int xfrin_switch_nodes(knot_zone_contents_t *contents_copy)
// Traverse the trees and for each node check every reference
// stored in that node. The node itself should be new.
knot_zone_tree_apply(contents_copy->nodes, xfrin_switch_nodes_in_node, NULL);
knot_zone_tree_apply(contents_copy->nsec3_nodes, xfrin_switch_nodes_in_node, NULL);
int ret = knot_zone_tree_apply(contents_copy->nodes,
xfrin_switch_nodes_in_node, NULL);
if (ret == KNOT_EOK) {
ret = knot_zone_tree_apply(contents_copy->nsec3_nodes,
xfrin_switch_nodes_in_node, NULL);
}
return KNOT_EOK;
return ret;
}
/*----------------------------------------------------------------------------*/
......@@ -2517,6 +2521,10 @@ int xfrin_prepare_zone_copy(knot_zone_contents_t *old_contents,
*/
dbg_xfrin("Switching ptrs pointing to old nodes to the new nodes.\n");
ret = xfrin_switch_nodes(contents_copy);
if (ret != KNOT_EOK) {
dbg_xfrin("Failed to switch pointers in nodes.\n");
return ret;
}
assert(knot_zone_contents_apex(contents_copy) != NULL);
*new_contents = contents_copy;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment