diff options
author | Christopher Faylor <me@cgf.cx> | 2011-10-22 20:26:30 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2011-10-22 20:26:30 +0400 |
commit | 6ae28c22639d43de76a9d45362df5055cd38a867 (patch) | |
tree | 1d68d36140425f822ed1ad4485051f25b9f71114 /winsup/cygwin/fhandler_console.cc | |
parent | bdea9e5fe8cb19d89015d8a6543ecab4b9e76a01 (diff) |
* dtable.cc (dtable::delete_archetype): Improve debugging output.
(dtable::init_std_file_from_handle): Close console handle early, before
initialization. Build up openflags for passing to open_setup, just to be safe.
(last_tty_dev): New variable.
(fh_last_tty_dev): New macro.
(fh_alloc): Try again to keep track of previously opened tty, this time by just
saving the device and using that to potentially open an archetype. Avoid
setting the "/dev/tty" name if the creation of the fhandler failed.
(build_fh_pc): Remove unused second argument. Reorganize how and where the
name is set. Set last_tty_dev as appropriate. Avoid a NULL dereference in a
debug printf.
* dtable.h (build_fh_pc): Reflect removal of second parameter.
* fhandler.cc (fhandler_base::reset): Use new '<<' operator to copy pc since it
preserves any potentially previously set name.
(fhandler_base::set_name): Ditto.
* fhandler.h (fhandler_*::clone): Throughout use ccalloc to allocate new
fhandler, primarily to make sure that pc field is properly zeroed.
(fhandler_termios::last): Eliminate.
(fhandler_termios): Remove setting of last.
(fhandler_base::~fhandler_termios): Ditto.
* fhandler_console.cc (fhandler_console::open): Don't make decisions about
opening close-on-exec handles here since it makes no sense for archetypes.
(fhandler_console::init): Assume that input handle has already been opened.
* fhandler_termios.cc (fhandler_termios::last): Delete.
* path.h (path_conv::eq_worker): New function. Move bulk of operator = here.
(operator <<): New function.
(operator =): Use eq_worker to perform old functionality.
Diffstat (limited to 'winsup/cygwin/fhandler_console.cc')
-rw-r--r-- | winsup/cygwin/fhandler_console.cc | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index cf97c5fc9..8335109f8 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -784,7 +784,7 @@ fhandler_console::open (int flags, mode_t) /* Open the input handle as handle_ */ h = CreateFile ("CONIN$", GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, sec_none_cloexec (flags), + FILE_SHARE_READ | FILE_SHARE_WRITE, &sec_none, OPEN_EXISTING, 0, 0); if (h == INVALID_HANDLE_VALUE) @@ -795,7 +795,7 @@ fhandler_console::open (int flags, mode_t) set_io_handle (h); h = CreateFile ("CONOUT$", GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, sec_none_cloexec (flags), + FILE_SHARE_READ | FILE_SHARE_WRITE, &sec_none, OPEN_EXISTING, 0, 0); if (h == INVALID_HANDLE_VALUE) @@ -2197,8 +2197,6 @@ fhandler_console::init (HANDLE h, DWORD a, mode_t bin) if (a == (GENERIC_READ | GENERIC_WRITE)) flags = O_RDWR; open_with_arch (flags | O_BINARY | (h ? 0 : O_NOCTTY)); - if (h && h != INVALID_HANDLE_VALUE) - CloseHandle (h); /* Reopened by open */ return !tcsetattr (0, &get_ttyp ()->ti); } |