Module Name:    src
Committed By:   pooka
Date:           Wed Feb  9 09:46:59 UTC 2011

Modified Files:
        src/lib/libc/resolv: res_send.c

Log Message:
Don't do highestFD check with USE_POLL.  It provides no benefit
but causes a dependency between RLIMIT_NOFILE and rumphijack FDOFF.

christos ok


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/resolv/res_send.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/resolv/res_send.c
diff -u src/lib/libc/resolv/res_send.c:1.20 src/lib/libc/resolv/res_send.c:1.21
--- src/lib/libc/resolv/res_send.c:1.20	Sat Oct 24 17:24:01 2009
+++ src/lib/libc/resolv/res_send.c	Wed Feb  9 09:46:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: res_send.c,v 1.20 2009/10/24 17:24:01 christos Exp $	*/
+/*	$NetBSD: res_send.c,v 1.21 2011/02/09 09:46:59 pooka Exp $	*/
 
 /*
  * Portions Copyright (C) 2004-2009  Internet Systems Consortium, Inc. ("ISC")
@@ -93,7 +93,7 @@
 static const char sccsid[] = "@(#)res_send.c	8.1 (Berkeley) 6/4/93";
 static const char rcsid[] = "Id: res_send.c,v 1.22 2009/01/22 23:49:23 tbox Exp";
 #else
-__RCSID("$NetBSD: res_send.c,v 1.20 2009/10/24 17:24:01 christos Exp $");
+__RCSID("$NetBSD: res_send.c,v 1.21 2011/02/09 09:46:59 pooka Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -157,8 +157,6 @@
 
 #ifndef USE_POLL
 static const int highestFD = FD_SETSIZE - 1;
-#else
-static int highestFD = 0;
 #endif
 
 /* Forward. */
@@ -333,10 +331,6 @@
 	int gotsomewhere, terrno, tries, v_circuit, resplen, ns, n;
 	char abuf[NI_MAXHOST];
 
-#ifdef USE_POLL
-	highestFD = sysconf(_SC_OPEN_MAX) - 1;
-#endif
-
 	(void)res_check(statp, NULL);
 
 	/* No name servers or res_init() failure */
@@ -669,10 +663,12 @@
 			res_nclose(statp);
 
 		statp->_vcsock = socket(nsap->sa_family, SOCK_STREAM, 0);
+#ifndef USE_POLL
 		if (statp->_vcsock > highestFD) {
 			res_nclose(statp);
 			errno = ENOTSOCK;
 		}
+#endif
 		if (statp->_vcsock < 0) {
 			switch (errno) {
 			case EPROTONOSUPPORT:
@@ -848,10 +844,12 @@
 	nsaplen = get_salen(nsap);
 	if (EXT(statp).nssocks[ns] == -1) {
 		EXT(statp).nssocks[ns] = socket(nsap->sa_family, SOCK_DGRAM, 0);
+#ifndef USE_POLL
 		if (EXT(statp).nssocks[ns] > highestFD) {
 			res_nclose(statp);
 			errno = ENOTSOCK;
 		}
+#endif
 		if (EXT(statp).nssocks[ns] < 0) {
 			switch (errno) {
 			case EPROTONOSUPPORT:

Reply via email to