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:
parent
bfec337701
commit
890147b8ea
|
@ -4455,3 +4455,8 @@ Mon Dec 31 16:28:46 2001 Michael Jennings (mej)
|
||||||
|
|
||||||
Minor debugging enhancements.
|
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.
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
|
@ -1428,9 +1428,17 @@ get_tty(void)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
unsigned short i;
|
unsigned short i;
|
||||||
|
unsigned long max_fds;
|
||||||
|
|
||||||
D_TTY(("Closing file descriptors 0-%d.\n", num_fds));
|
/* get number of available file descriptors */
|
||||||
for (i = 0; i < num_fds; i++) {
|
#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)
|
if (i != fd)
|
||||||
close(i);
|
close(i);
|
||||||
}
|
}
|
||||||
|
@ -2095,6 +2103,7 @@ run_command(char **argv)
|
||||||
privileges(IGNORE);
|
privileges(IGNORE);
|
||||||
|
|
||||||
ptyfd = get_pty();
|
ptyfd = get_pty();
|
||||||
|
AT_LEAST(num_fds, ptyfd);
|
||||||
if (ptyfd < 0)
|
if (ptyfd < 0)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
|
@ -2267,13 +2276,6 @@ init_command(char **argv)
|
||||||
|
|
||||||
init_locale();
|
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
|
#ifdef META8_OPTION
|
||||||
meta_char = (Options & Opt_meta8 ? 0x80 : 033);
|
meta_char = (Options & Opt_meta8 ? 0x80 : 033);
|
||||||
#endif
|
#endif
|
||||||
|
@ -2285,6 +2287,10 @@ init_command(char **argv)
|
||||||
Xfd = XConnectionNumber(Xdisplay);
|
Xfd = XConnectionNumber(Xdisplay);
|
||||||
D_CMD(("Xfd = %d\n", Xfd));
|
D_CMD(("Xfd = %d\n", Xfd));
|
||||||
cmdbuf_ptr = cmdbuf_endp = cmdbuf_base;
|
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) {
|
if ((cmd_fd = run_command(argv)) < 0) {
|
||||||
print_error("aborting\n");
|
print_error("aborting\n");
|
||||||
|
@ -2522,7 +2528,7 @@ cmd_getc(void)
|
||||||
} else {
|
} else {
|
||||||
delay = &value;
|
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 */
|
/* See if we can read from the application */
|
||||||
if (cmd_fd >= 0 && FD_ISSET(cmd_fd, &readfds)) {
|
if (cmd_fd >= 0 && FD_ISSET(cmd_fd, &readfds)) {
|
||||||
|
|
|
@ -301,6 +301,10 @@ inline void *memmove(void *, const void *, size_t);
|
||||||
# define PATH_ENV "ETERMPATH"
|
# define PATH_ENV "ETERMPATH"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !(HAVE_SAVED_UIDS) && defined(_POSIX_VERSION) && (_POSIX_SAVED_IDS)
|
||||||
|
# define HAVE_SAVED_UIDS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/* utmp doesn't work on CygWin32 */
|
/* utmp doesn't work on CygWin32 */
|
||||||
#ifdef __CYGWIN32__
|
#ifdef __CYGWIN32__
|
||||||
# undef UTMP_SUPPORT
|
# undef UTMP_SUPPORT
|
||||||
|
|
Loading…
Reference in New Issue