summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-02-21 17:10:09 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-02-21 17:10:09 +0000
commit83c1e3f841be6385735cc45d18629ebd63bfc680 (patch)
tree016fca1beaceb46c1a6cc320f281264ac41ea785
parentb1d1a585310de4e1db8f2c22f1de4f7e97b22d0e (diff)
FreeBSD PR ports/2766 (Patch from Marc Slemko marcs@znep.com):
Don't pass getdtablesize() as first arg to select(2). No need to do this since we only select on one fd--use (fd+1) as nfds. This fixes the problem with fdesc as well (though that is really an fdesc bug). Fix will be in sudo 1.5.4.
-rw-r--r--gnu/usr.bin/sudo/sudo/tgetpass.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/gnu/usr.bin/sudo/sudo/tgetpass.c b/gnu/usr.bin/sudo/sudo/tgetpass.c
index e92178517ba..0031986e293 100644
--- a/gnu/usr.bin/sudo/sudo/tgetpass.c
+++ b/gnu/usr.bin/sudo/sudo/tgetpass.c
@@ -27,7 +27,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: tgetpass.c,v 1.2 1996/11/17 16:34:06 millert Exp $";
+static char rcsid[] = "$Id: tgetpass.c,v 1.3 1997/02/21 17:10:08 millert Exp $";
#endif /* lint */
#include "config.h"
@@ -206,18 +206,12 @@ char * tgetpass(prompt, timeout, user, host)
tv.tv_sec = timeout;
tv.tv_usec = 0;
- /* how many file descriptors may we have? */
-#ifdef HAVE_SYSCONF
- n = sysconf(_SC_OPEN_MAX);
-#else
- n = getdtablesize();
-#endif /* HAVE_SYSCONF */
-
/*
* get password or return empty string if nothing to read by timeout
*/
buf[0] = '\0';
- if (select(n, &readfds, 0, 0, &tv) > 0 && fgets(buf, sizeof(buf), input)) {
+ if (select(fileno(input) + 1, &readfds, 0, 0, &tv) > 0 &&
+ fgets(buf, sizeof(buf), input)) {
n = strlen(buf);
if (buf[n - 1] == '\n')
buf[n - 1] = '\0';