[uClibc] resolv.c doesn't try all search domains

Jan Lana Jan.Lana at Sun.COM
Thu Dec 2 10:39:39 UTC 2004


Hi,

uClibc resolver doesn't lookup all search domains.
For example, if you have computer 'jenda.prague.my.cz' and resolv.conf:
search my.cz
nameserver xx.xx.xx.xx

try this:
ping jenda.prague.my.cz 	#works
ping jenda.prague		#unknown host

libc/inet/resolv.c doesn't want to try search domains if the domain name
contains '.'. I don't find any reason for the behaviour in literature
and it is inconsistent with the glibc.

Patch is attached.

regards,
- jenda
-------------- next part --------------
diff -ur uClibc.orig/libc/inet/resolv.c uClibc/libc/inet/resolv.c
--- uClibc.orig/libc/inet/resolv.c	2004-09-07 12:34:35.000000000 +0200
+++ uClibc/libc/inet/resolv.c	2004-12-02 12:00:06.000000000 +0100
@@ -717,7 +717,7 @@
 
 		strncpy(lookup,name,MAXDNAME);
 		BIGLOCK;
-		if (variant < __searchdomains && strchr(lookup, '.') == NULL)
+		if (variant < __searchdomains)
 		{
 		    strncat(lookup,".", MAXDNAME);
 		    strncat(lookup,__searchdomain[variant], MAXDNAME);
@@ -884,7 +884,7 @@
 		    sdomains=__searchdomains;
 		    BIGUNLOCK;
 
-		    if (variant < ((sdomains - 1) && strchr(lookup, '.') == NULL)) {
+		    if (variant < sdomains - 1) {
 			/* next search */
 			variant++;
 		    } else {


More information about the uClibc mailing list