On 02/25/10 06:03 PM, Robert Milkowski wrote:
Hi,

mi...@vault:~$ cat dns.c

#include<stdlib.h>
#include<sys/types.h>
#include<netinet/in.h>
#include<arpa/nameser.h>
#include<resolv.h>
#include<netdb.h>

int main(int argc, char **argv)
{
   res_init();
   if (!_res.nscount) {
     fprintf(stderr,"No nameservers defined.\n");
     exit(1);
   }
}


mi...@vault:~$ gcc -o dns -lresolv  -lsocket   -lnsl dns.c
...
it works fine on b111 but fails on b132 and b133 (I haven't tested any other 
builds).

Did you check _res.res_h_errno?  I would note that res_init() is deprecated.

If an error is encountered during res_init()'s initial logic, it will effectively set nscount to 0 because it sets maxns = 0. [1]

--
Shawn Walker

[1] http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libresolv2/common/resolv/res_init.c
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to