summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mdk-stage1/dns.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/mdk-stage1/dns.c b/mdk-stage1/dns.c
index e7e045b97..e323817b6 100644
--- a/mdk-stage1/dns.c
+++ b/mdk-stage1/dns.c
@@ -45,20 +45,17 @@ int mygethostbyname(char * name, struct in_addr * addr)
return -1;
h = gethostbyname(name);
+ if (!h && ddomain) {
+ // gethostbyname from dietlibc doesn't support domain handling
+ char fully_qualified[500];
+ sprintf(fully_qualified, "%s.%s", name, domain);
+ h = gethostbyname(fully_qualified);
+ }
if (!h) {
- if (domain) {
- // gethostbyname from dietlibc doesn't support domain handling
- char fully_qualified[500];
- sprintf(fully_qualified, "%s.%s", name, domain);
- h = gethostbyname(fully_qualified);
- if (!h) {
- log_message("unknown host %s", name);
- return -1;
- }
- } else
- return -1;
+ log_message("unknown host %s", name);
+ return -1;
}
-
+
if (h->h_addr_list && (h->h_addr_list)[0]) {
memcpy(addr, (h->h_addr_list)[0], sizeof(*addr));
log_message("is-at: %s", inet_ntoa(*addr));