>From 2c80f5fa6cb55ed5b69e2bd74c921af618027015 Mon Sep 17 00:00:00 2001
From: Kenneth Soerensen <[email protected]>
Date: Wed, 10 Apr 2013 17:10:37 +0200
Subject: [PATCH 3/3] Fix lookup with DNS search domains when res_init() is
 used in multi-threaded application.

In a multi-threaded application where res_init() was called either
directly or implicitly, getaddrinfo() and others failed to add the
DNS search domain to hostnames.

This problem made it not possible to look up a hostname without its
domain appended.

The problem is caused by res_sync_func() overwriting the configuration
read by __open_nameservers() immediately after it is read.

The suggested solutin is to disable res_sync_func() while reading name
server configuration in res_init().

Signed-off-by: Kenneth Soerensen <[email protected]>
---
 libc/inet/resolv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index c230534..27368b5 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -3574,6 +3574,7 @@ res_init(void)
        if (!_res.id)
                _res.id = res_randomid();
 
+       __res_sync = NULL;
        __res_vinit(&_res, 1);
        __res_sync = res_sync_func;
 
-- 
1.8.1.4

_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to