1999-03-07 Mark Kettenis <kettenis@gnu.org>
[kopensolaris-gnu/glibc.git] / resolv / res_init.c
index b22611b..893072f 100644 (file)
@@ -206,12 +206,13 @@ res_init()
 
 #ifdef USELOOPBACK
        _res.nsaddr.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1);
+       _res.nscount = 1;
 #else
        _res.nsaddr.sin_addr.s_addr = INADDR_ANY;
+       _res.nscount = 0;
 #endif
        _res.nsaddr.sin_family = AF_INET;
        _res.nsaddr.sin_port = htons(NAMESERVER_PORT);
-       _res.nscount = 1;
        _res.ndots = 1;
        _res.pfcode = 0;
 
@@ -378,7 +379,7 @@ res_init()
                    continue;
                }
            }
-           if (nserv > 1)
+           if (nserv > _res.nscount)
                _res.nscount = nserv;
 #ifdef RESOLVSORT
            _res.nsort = nsort;
@@ -386,7 +387,7 @@ res_init()
            (void) fclose(fp);
        }
        if (_res.defdname[0] == 0 &&
-           gethostname(buf, sizeof(_res.defdname) - 1) == 0 &&
+           __gethostname(buf, sizeof(_res.defdname) - 1) == 0 &&
            (cp = strchr(buf, '.')) != NULL)
                strcpy(_res.defdname, cp + 1);
 
@@ -571,7 +572,7 @@ netinfo_res_init(haveenv, havesearch)
                    ni_namelist_free(&nl);
                }
 
-               if (nserv > 1)
+               if (nserv > _res.nscount)
                    _res.nscount = nserv;
 
 #ifdef RESOLVSORT
@@ -651,6 +652,6 @@ res_randomid()
 {
        struct timeval now;
 
-       gettimeofday(&now, NULL);
-       return (0xffff & (now.tv_sec ^ now.tv_usec ^ getpid()));
+       __gettimeofday(&now, NULL);
+       return (0xffff & (now.tv_sec ^ now.tv_usec ^ __getpid()));
 }