What is the return code from res_init()? The sample code does not check! An additional safety enhancement to res_init/res_ninit is to set the number of name servers to zero when malloc fails to allocate additional space required to hold information used for IPv6.
The following is extract from res_init.c: http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libresolv2/common/resolv/res_init.c#250 243 statp->_u._ext.nscount = 0; 244 statp->_u._ext.ext = malloc(sizeof(*statp->_u._ext.ext)); 245 if (statp->_u._ext.ext != NULL) { 246 memset(statp->_u._ext.ext, 0, sizeof(*statp->_u._ext.ext)); 247 statp->_u._ext.ext->nsaddrs[0].sin = statp->nsaddr; 248 strcpy(statp->_u._ext.ext->nsuffix, "ip6.arpa"); 249 strcpy(statp->_u._ext.ext->nsuffix2, "ip6.int"); 250 } else { 251 /* 252 * Historically res_init() rarely, if at all, failed. 253 * Examples and applications exist which do not check 254 * our return code. Furthermore several applications 255 * simply call us to get the systems domainname. So 256 * rather then immediately fail here we store the 257 * failure, which is returned later, in h_errno. And 258 * prevent the collection of 'nameserver' information 259 * by setting maxns to 0. Thus applications that fail 260 * to check our return code wont be able to make 261 * queries anyhow. 262 */ 263 RES_SET_H_ERRNO(statp, NETDB_INTERNAL); 264 maxns = 0; Regards Stacey -- This message posted from opensolaris.org _______________________________________________ opensolaris-code mailing list opensolaris-code@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/opensolaris-code