=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/sudo/Attic/sudo.c,v retrieving revision 1.21 retrieving revision 1.22 diff -c -r1.21 -r1.22 *** src/usr.bin/sudo/Attic/sudo.c 2003/12/23 02:19:51 1.21 --- src/usr.bin/sudo/Attic/sudo.c 2004/01/12 19:13:21 1.22 *************** *** 862,873 **** static void initial_setup() { ! int fd, maxfd; ! #ifdef HAVE_SETRLIMIT struct rlimit rl; - #endif - #if defined(RLIMIT_CORE) && !defined(SUDO_DEVEL) /* * Turn off core dumps. */ --- 862,870 ---- static void initial_setup() { ! #if defined(RLIMIT_CORE) && !defined(SUDO_DEVEL) struct rlimit rl; /* * Turn off core dumps. */ *************** *** 877,899 **** (void) setrlimit(RLIMIT_CORE, &rl); #endif /* RLIMIT_CORE && !SUDO_DEVEL */ ! /* ! * Close any open fd's other than stdin, stdout and stderr. ! */ ! #ifdef HAVE_SYSCONF ! maxfd = sysconf(_SC_OPEN_MAX) - 1; ! #else ! maxfd = getdtablesize() - 1; ! #endif /* HAVE_SYSCONF */ ! #ifdef RLIMIT_NOFILE ! if (getrlimit(RLIMIT_NOFILE, &rl) == 0) { ! if (rl.rlim_max != RLIM_INFINITY && rl.rlim_max <= maxfd) ! maxfd = rl.rlim_max - 1; ! } ! #endif /* RLIMIT_NOFILE */ ! ! for (fd = maxfd; fd > STDERR_FILENO; fd--) ! (void) close(fd); /* * Make set_perms point to the correct function. --- 874,880 ---- (void) setrlimit(RLIMIT_CORE, &rl); #endif /* RLIMIT_CORE && !SUDO_DEVEL */ ! closefrom(STDERR_FILENO + 1); /* * Make set_perms point to the correct function.