summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJelte Jansen <jeltejan@NLnetLabs.nl>2006-06-30 14:46:41 +0200
committerJelte Jansen <jeltejan@NLnetLabs.nl>2006-06-30 14:46:41 +0200
commit6c82939e71cfc69d2146b6a033f5a310ad886770 (patch)
tree6d2be76b5948f9a1fac05b16dc5eae6db20eda2e /examples
parenta60c156389b0d70405e7b03f3fa2b517351f2b01 (diff)
downloadldns-6c82939e71cfc69d2146b6a033f5a310ad886770.tar.gz
extra error check creating resolver
Diffstat (limited to 'examples')
-rw-r--r--examples/ldns-keyfetcher.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/examples/ldns-keyfetcher.c b/examples/ldns-keyfetcher.c
index 0a5fca81..63071095 100644
--- a/examples/ldns-keyfetcher.c
+++ b/examples/ldns-keyfetcher.c
@@ -641,11 +641,15 @@ main(int argc, char *argv[])
if (status != LDNS_STATUS_OK) {
fprintf(stderr, "Warning: Unable to create stub resolver from /etc/resolv.conf:\n");
- fprintf("%s\n", ldns_get_errorstr_by_id(status));
+ fprintf(stderr, "%s\n", ldns_get_errorstr_by_id(status));
fprintf(stderr, "defaulting to nameserver at 127.0.0.1 for separate nameserver name lookups\n");
res = ldns_resolver_new();
ns = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A, "127.0.0.1");
- ldns_resolver_push_nameserver(res, ns);
+ status = ldns_resolver_push_nameserver(res, ns);
+ if (status != LDNS_STATUS_OK) {
+ fprintf(stderr, "Unable to create stub resolver: %s\n", ldns_get_errorstr_by_id(status));
+ exit(EXIT_FAILURE);
+ }
ldns_rdf_deep_free(ns);
}
@@ -690,8 +694,8 @@ main(int argc, char *argv[])
ldns_rr_list_print(stdout, l);
}
} else {
- printf("no answer packet received, stub resolver config:\n");
- ldns_resolver_print(stdout, res);
+ fprintf(stderr, "no answer packet received, stub resolver config:\n");
+ ldns_resolver_print(stderr, res);
}
printf("\n");