Thu Jan 3 12:38:54 2002 Michael Jennings (mej)

Fixed the select() call based on info from Paul W Brannan
<pbranna@clemson.edu>.  Also added check for _POSIX_SAVED_IDS.


SVN revision: 5804
This commit is contained in:
Michael Jennings 2002-01-03 17:41:23 +00:00
parent bfec337701
commit 890147b8ea
3 changed files with 25 additions and 10 deletions

View File

@ -4455,3 +4455,8 @@ Mon Dec 31 16:28:46 2001 Michael Jennings (mej)
Minor debugging enhancements.
----------------------------------------------------------------------
Thu Jan 3 12:38:54 2002 Michael Jennings (mej)
Fixed the select() call based on info from Paul W Brannan
<pbranna@clemson.edu>. Also added check for _POSIX_SAVED_IDS.
----------------------------------------------------------------------

View File

@ -1428,9 +1428,17 @@ get_tty(void)
*/
{
unsigned short i;
unsigned long max_fds;
D_TTY(("Closing file descriptors 0-%d.\n", num_fds));
for (i = 0; i < num_fds; i++) {
/* get number of available file descriptors */
#ifdef _POSIX_VERSION
max_fds = sysconf(_SC_OPEN_MAX);
#else
max_fds = getdtablesize();
#endif
D_TTY(("Closing file descriptors 0-%d.\n", max_fds));
for (i = 0; i < max_fds; i++) {
if (i != fd)
close(i);
}
@ -2095,6 +2103,7 @@ run_command(char **argv)
privileges(IGNORE);
ptyfd = get_pty();
AT_LEAST(num_fds, ptyfd);
if (ptyfd < 0)
return (-1);
@ -2267,13 +2276,6 @@ init_command(char **argv)
init_locale();
/* get number of available file descriptors */
#ifdef _POSIX_VERSION
num_fds = sysconf(_SC_OPEN_MAX);
#else
num_fds = getdtablesize();
#endif
#ifdef META8_OPTION
meta_char = (Options & Opt_meta8 ? 0x80 : 033);
#endif
@ -2285,6 +2287,10 @@ init_command(char **argv)
Xfd = XConnectionNumber(Xdisplay);
D_CMD(("Xfd = %d\n", Xfd));
cmdbuf_ptr = cmdbuf_endp = cmdbuf_base;
AT_LEAST(num_fds, Xfd);
if (pipe_fd >= 0) {
AT_LEAST(num_fds, pipe_fd);
}
if ((cmd_fd = run_command(argv)) < 0) {
print_error("aborting\n");
@ -2522,7 +2528,7 @@ cmd_getc(void)
} else {
delay = &value;
}
retval = select(num_fds, &readfds, NULL, NULL, delay);
retval = select(num_fds + 1, &readfds, NULL, NULL, delay);
/* See if we can read from the application */
if (cmd_fd >= 0 && FD_ISSET(cmd_fd, &readfds)) {

View File

@ -301,6 +301,10 @@ inline void *memmove(void *, const void *, size_t);
# define PATH_ENV "ETERMPATH"
#endif
#if !(HAVE_SAVED_UIDS) && defined(_POSIX_VERSION) && (_POSIX_SAVED_IDS)
# define HAVE_SAVED_UIDS 1
#endif
/* utmp doesn't work on CygWin32 */
#ifdef __CYGWIN32__
# undef UTMP_SUPPORT