1/* 2 * Copyright (c) 1985, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 59 unchanged lines hidden (view full) --- 68 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 69 */ 70 71#if defined(LIBC_SCCS) && !defined(lint) 72static const char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93"; 73static const char rcsid[] = "$Id: res_init.c,v 1.9.2.5.4.5 2005/11/03 00:00:52 marka Exp $"; 74#endif /* LIBC_SCCS and not lint */ 75#include <sys/cdefs.h> |
76__FBSDID("$FreeBSD: head/lib/libc/resolv/res_init.c 160965 2006-08-04 10:21:11Z ume $"); |
77 78#include "port_before.h" 79 |
80#include "namespace.h" 81 |
82#include <sys/types.h> 83#include <sys/param.h> 84#include <sys/socket.h> 85#include <sys/time.h> 86 87#include <netinet/in.h> 88#include <arpa/inet.h> 89#include <arpa/nameser.h> 90 91#include <ctype.h> 92#include <stdio.h> 93#include <stdlib.h> 94#include <string.h> 95#include <unistd.h> 96#include <netdb.h> 97 |
98#include "un-namespace.h" 99 |
100#include "port_after.h" 101 102/* ensure that sockaddr_in6 and IN6ADDR_ANY_INIT are declared / defined */ 103#include <resolv.h> 104 105#include "res_private.h" 106 107/* Options. Should all be left alone. */ --- 626 unchanged lines hidden (view full) --- 734 * 735 * This routine is not expected to be user visible. 736 */ 737void 738res_nclose(res_state statp) { 739 int ns; 740 741 if (statp->_vcsock >= 0) { |
742 (void) _close(statp->_vcsock); |
743 statp->_vcsock = -1; 744 statp->_flags &= ~(RES_F_VC | RES_F_CONN); 745 } 746 for (ns = 0; ns < statp->_u._ext.nscount; ns++) { 747 if (statp->_u._ext.nssocks[ns] != -1) { |
748 (void) _close(statp->_u._ext.nssocks[ns]); |
749 statp->_u._ext.nssocks[ns] = -1; 750 } 751 } 752} 753 754void 755res_ndestroy(res_state statp) { 756 res_nclose(statp); --- 118 unchanged lines hidden --- |