]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
kdig: unify error states
authorDaniel Salzman <daniel.salzman@nic.cz>
Wed, 2 Jan 2019 10:18:37 +0000 (11:18 +0100)
committerDaniel Salzman <daniel.salzman@nic.cz>
Wed, 2 Jan 2019 10:18:37 +0000 (11:18 +0100)
src/utils/kdig/kdig_exec.c

index 36b8e237f9962be52380f175362f05151b6519e9..0cdffe265e4c0d1868db6678d6653fbc177b2a5c 100644 (file)
@@ -665,7 +665,7 @@ static int process_query_packet(const knot_pkt_t      *query,
                if (reply == NULL) {
                        ERR("internal error (%s)\n", knot_strerror(KNOT_ENOMEM));
                        net_close(net);
-                       return 0;
+                       return -1;
                }
 
                // Parse reply to the packet structure.
@@ -673,7 +673,7 @@ static int process_query_packet(const knot_pkt_t      *query,
                        ERR("malformed reply packet from %s\n", net->remote_str);
                        knot_pkt_free(reply);
                        net_close(net);
-                       return 0;
+                       return -1;
                }
 
                // Compare reply header id.
@@ -958,7 +958,7 @@ static int process_xfr_packet(const knot_pkt_t      *query,
                if (reply == NULL) {
                        ERR("internal error (%s)\n", knot_strerror(KNOT_ENOMEM));
                        net_close(net);
-                       return 0;
+                       return -1;
                }
 
                // Parse reply to the packet structure.
@@ -966,7 +966,7 @@ static int process_xfr_packet(const knot_pkt_t      *query,
                        ERR("malformed reply packet from %s\n", net->remote_str);
                        knot_pkt_free(reply);
                        net_close(net);
-                       return 0;
+                       return -1;
                }
 
                // Compare reply header id.
@@ -974,7 +974,7 @@ static int process_xfr_packet(const knot_pkt_t      *query,
                        ERR("reply ID mismatch from %s\n", net->remote_str);
                        knot_pkt_free(reply);
                        net_close(net);
-                       return 0;
+                       return -1;
                }
 
                // Print leading transfer information.
@@ -988,7 +988,7 @@ static int process_xfr_packet(const knot_pkt_t      *query,
                            knot_pkt_ext_rcode_name(reply));
                        knot_pkt_free(reply);
                        net_close(net);
-                       return 0;
+                       return -1;
                }
 
                // The first message has a special treatment.
@@ -1008,7 +1008,7 @@ static int process_xfr_packet(const knot_pkt_t      *query,
                                            net->remote_str, knot_strerror(ret));
                                        knot_pkt_free(reply);
                                        net_close(net);
-                                       return 0;
+                                       return -1;
                                }
                        }
 
@@ -1020,7 +1020,7 @@ static int process_xfr_packet(const knot_pkt_t      *query,
                                    net->remote_str);
                                knot_pkt_free(reply);
                                net_close(net);
-                               return 0;
+                               return -1;
                        }
 
                        // Check for question sections equality.