summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libc/inet/resolv.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index e676f5371..f378c9b9d 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -1264,7 +1264,7 @@ int __dns_lookup(const char *name,
int variant = -1; /* search domain to append, -1: none */
int local_ns_num = -1; /* Nth server to use */
int local_id = local_id; /* for compiler */
- int sdomains;
+ int sdomains = 0;
bool ends_with_dot;
sockaddr46_t sa;
@@ -1302,7 +1302,9 @@ int __dns_lookup(const char *name,
* or do other Really Bad Things. */
__UCLIBC_MUTEX_LOCK(__resolv_lock);
__open_nameservers();
- sdomains = __searchdomains;
+ if (type != T_PTR) {
+ sdomains = __searchdomains;
+ }
lookup[name_len] = '\0';
if ((unsigned)variant < sdomains) {
/* lookup is name_len + 1 + MAXLEN_searchdomain + 1 long */