* dtable.cc (dtable::init_std_file_from_handle): Force "devices" to always be

in binary mode.  Temporary fix until ssh is rebuilt?
This commit is contained in:
Christopher Faylor 2002-10-18 01:28:48 +00:00
parent fef1edbc9a
commit abb58a6d3f
2 changed files with 16 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2002-10-17 Christopher Faylor <cgf@redhat.com>
* dtable.cc (dtable::init_std_file_from_handle): Force "devices" to
always be in binary mode. Temporary fix until ssh is rebuilt?
2002-10-17 Christopher Faylor <cgf@redhat.com> 2002-10-17 Christopher Faylor <cgf@redhat.com>
* dtable.cc (dtable::set_file_pointers_for_exec): New function. * dtable.cc (dtable::set_file_pointers_for_exec): New function.

View File

@ -220,6 +220,7 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle)
struct sockaddr sa; struct sockaddr sa;
int sal = sizeof (sa); int sal = sizeof (sa);
DCB dcb; DCB dcb;
unsigned bin = O_BINARY;
first_fd_for_open = 0; first_fd_for_open = 0;
@ -259,7 +260,10 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle)
else if (GetCommState (handle, &dcb)) else if (GetCommState (handle, &dcb))
name = "/dev/ttyS0"; // FIXME - determine correct device name = "/dev/ttyS0"; // FIXME - determine correct device
else else
{
name = handle_to_fn (handle, (char *) alloca (MAX_PATH + 100)); name = handle_to_fn (handle, (char *) alloca (MAX_PATH + 100));
bin = 0;
}
} }
if (!name) if (!name)
@ -267,11 +271,13 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle)
else else
{ {
path_conv pc; path_conv pc;
unsigned bin;
fhandler_base *fh = build_fhandler_from_name (fd, name, handle, pc); fhandler_base *fh = build_fhandler_from_name (fd, name, handle, pc);
if (!bin)
{
bin = fh->get_default_fmode (O_RDWR); bin = fh->get_default_fmode (O_RDWR);
if (!bin && name != unknown_file) if (!bin && name != unknown_file)
bin = pc.binmode (); bin = pc.binmode ();
}
fh->init (handle, GENERIC_READ | GENERIC_WRITE, bin); fh->init (handle, GENERIC_READ | GENERIC_WRITE, bin);
set_std_handle (fd); set_std_handle (fd);