Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve error messages #221

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion drill/drill.c
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ main(int argc, char *argv[])
status = ldns_send_buffer(&pkt, res, query_buffer, NULL);
ldns_buffer_free(query_buffer);
if (status != LDNS_STATUS_OK) {
printf("Error: %s\n", ldns_get_errorstr_by_id(status));
fprintf(stderr, "Error: %s\n", ldns_get_errorstr_by_id(status));
exit(1);
}
} else {
Expand Down
12 changes: 6 additions & 6 deletions examples/ldns-walk.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ main(int argc, char *argv[])
/* create a new resolver from /etc/resolv.conf */
if(!serv) {
if (ldns_resolver_new_frm_file(&res, NULL) != LDNS_STATUS_OK) {
fprintf(stderr, "%s", "Could not create resolver obj");
fprintf(stderr, "%s\n", "Could not create resolver obj.");
result = EXIT_FAILURE;
goto exit;
}
Expand All @@ -344,7 +344,7 @@ main(int argc, char *argv[])
status = ldns_resolver_new_frm_file(&cmdline_res, NULL);

if (status != LDNS_STATUS_OK) {
fprintf(stderr, "%s", "@server ip could not be converted");
fprintf(stderr, "%s\n", "@server ip could not be converted");
result = EXIT_FAILURE;
goto exit;
}
Expand All @@ -358,15 +358,15 @@ main(int argc, char *argv[])
ldns_rdf_deep_free(cmdline_dname);
ldns_resolver_deep_free(cmdline_res);
if (!cmdline_rr_list) {
fprintf(stderr, "%s %s", "could not find any address for the name: ", serv);
fprintf(stderr, "%s %s\n", "Could not find any address for the name:", serv);
result = EXIT_FAILURE;
goto exit;
} else {
if (ldns_resolver_push_nameserver_rr_list(
res,
cmdline_rr_list
) != LDNS_STATUS_OK) {
fprintf(stderr, "%s", "pushing nameserver");
fprintf(stderr, "%s\n", "pushing nameserver");
result = EXIT_FAILURE;
ldns_rr_list_deep_free(cmdline_rr_list);
goto exit;
Expand All @@ -375,7 +375,7 @@ main(int argc, char *argv[])
}
} else {
if (ldns_resolver_push_nameserver(res, serv_rdf) != LDNS_STATUS_OK) {
fprintf(stderr, "%s", "pushing nameserver");
fprintf(stderr, "%s\n", "pushing nameserver");
result = EXIT_FAILURE;
goto exit;
} else {
Expand Down Expand Up @@ -569,7 +569,7 @@ main(int argc, char *argv[])
if (!rrlist) {
fflush(stdout);
fprintf(stderr, "Zone does not seem to be DNSSEC secured,"
"or it uses NSEC3.\n");
" or it uses NSEC3.\n");
fflush(stderr);
goto exit;
}
Expand Down
8 changes: 4 additions & 4 deletions masterdont/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,23 +240,23 @@ handle_listen(struct server_info_t *sinfo, struct socket_service* listen_v)
int newfd;

if(sinfo->num_tcp >= MAX_TCP) {
printf("Error: incoming tcp query, but MAX_TCP reached (%d)\n",
fprintf(stderr, "Error: incoming tcp query, but MAX_TCP reached (%d)\n",
MAX_TCP);
return;
}

if((newfd=accept(listen_v->s, NULL, NULL)) == -1) {
printf("Error tcp accept: %s", strerror(errno));
fprintf(stderr, "Error tcp accept: %s", strerror(errno));
return;
}
if(fcntl(newfd, F_SETFL, O_NONBLOCK) == -1) {
printf("Error fcntl: %s\n", strerror(errno));
fprintf(stderr, "Error fcntl: %s\n", strerror(errno));
close(newfd);
return;
}
sh = (struct socket_service*)malloc(sizeof(struct socket_service));
if(!sh) {
printf("out of memory\n");
fprintf(stderr, "malloc: %s\n", strerror(errno));
close(newfd);
return;
}
Expand Down