diff options
author | Christopher Faylor <me@cgf.cx> | 2012-04-18 09:57:38 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2012-04-18 09:57:38 +0400 |
commit | 55dcba98dbd120db696fba3dda62a348599a2889 (patch) | |
tree | 5be98efdaef583aac94002838c200fa23adf2889 /winsup/cygwin | |
parent | c1d26a99cd72be7ab41411d7c49b7dc6c063734d (diff) |
* fhandler.h (fhandler_base::nohandle): Revert to standard implementation.
* dtable.cc (dtable::fixup_after_exec): Specifically reject releasing
nohandle() type fhandlers rather than relying on contents of io_handle.
(dtable::fixup_after_fork): Ditto.
* fhandler_termios.cc: Add includes necessary for definitions of have_execed
and have_execed_cygwin.
(fhandler_termios::sigflush): Don't flush console input when we've started a
non-Cygwin process.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r-- | winsup/cygwin/ChangeLog | 12 | ||||
-rw-r--r-- | winsup/cygwin/dtable.cc | 4 | ||||
-rw-r--r-- | winsup/cygwin/fhandler.h | 9 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_termios.cc | 6 |
4 files changed, 20 insertions, 11 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 29b304e21..c83267ed2 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,15 @@ +2012-04-18 Christopher Faylor <me.cygwin2012@cgf.cx> + + * fhandler.h (fhandler_base::nohandle): Revert to standard + implementation. + * dtable.cc (dtable::fixup_after_exec): Specifically reject releasing + nohandle() type fhandlers rather than relying on contents of io_handle. + (dtable::fixup_after_fork): Ditto. + * fhandler_termios.cc: Add includes necessary for definitions of + have_execed and have_execed_cygwin. + (fhandler_termios::sigflush): Don't flush console input when we've + started a non-Cygwin process. + 2012-04-15 Christopher Faylor <me.cygwin2012@cgf.cx> * wincap.h: Rename assitant to assistant throughout. diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index 498e7fd8d..27e741c02 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -863,7 +863,7 @@ dtable::fixup_after_exec () /* Close the handle if it's close-on-exec or if an error was detected (typically with opening a console in a gui app) by fixup_after_exec. */ - if (fh->close_on_exec () || !fh->get_io_handle ()) + if (fh->close_on_exec () || (!fh->nohandle () && !fh->get_io_handle ())) fixup_close (i, fh); else if (fh->get_popen_pid ()) close (i); @@ -885,7 +885,7 @@ dtable::fixup_after_fork (HANDLE parent) { debug_printf ("fd %d (%s)", i, fh->get_name ()); fh->fixup_after_fork (parent); - if (!fh->get_io_handle ()) + if (!fh->nohandle () && !fh->get_io_handle ()) { /* This should actually never happen but it's here to make sure we don't crash due to access of an unopened file handle. */ diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 20b91392c..a4c4cd138 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -241,20 +241,13 @@ class fhandler_base IMPLEMENT_STATUS_FLAG (bool, wbinset) IMPLEMENT_STATUS_FLAG (bool, rbinset) + IMPLEMENT_STATUS_FLAG (bool, nohandle) IMPLEMENT_STATUS_FLAG (bool, did_lseek) IMPLEMENT_STATUS_FLAG (query_state, query_open) IMPLEMENT_STATUS_FLAG (bool, close_on_exec) IMPLEMENT_STATUS_FLAG (bool, need_fork_fixup) IMPLEMENT_STATUS_FLAG (bool, isclosed) - bool nohandle () const {return !!status.nohandle;} - bool nohandle (bool val) - { - if ((status.nohandle = val)) - io_handle = INVALID_HANDLE_VALUE; - return val; - } - int get_default_fmode (int flags); virtual void set_close_on_exec (bool val); diff --git a/winsup/cygwin/fhandler_termios.cc b/winsup/cygwin/fhandler_termios.cc index 70fb12877..7fddba5b3 100644 --- a/winsup/cygwin/fhandler_termios.cc +++ b/winsup/cygwin/fhandler_termios.cc @@ -19,6 +19,9 @@ details. */ #include "pinfo.h" #include "tty.h" #include "cygtls.h" +#include "dtable.h" +#include "cygheap.h" +#include "child_info.h" #include "ntdll.h" /* Common functions shared by tty/console */ @@ -397,7 +400,8 @@ fhandler_termios::sigflush () /* FIXME: Checking get_ttyp() for NULL is not right since it should not be NULL while this is alive. However, we can conceivably close a ctty while exiting and that will zero this. */ - if (get_ttyp () && !(get_ttyp ()->ti.c_lflag & NOFLSH)) + if ((!have_execed || have_execed_cygwin) && get_ttyp () + && !(get_ttyp ()->ti.c_lflag & NOFLSH)) tcflush (TCIFLUSH); } |