* 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.
This commit is contained in:
parent
c1d26a99cd
commit
55dcba98db
|
@ -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>
|
2012-04-15 Christopher Faylor <me.cygwin2012@cgf.cx>
|
||||||
|
|
||||||
* wincap.h: Rename assitant to assistant throughout.
|
* wincap.h: Rename assitant to assistant throughout.
|
||||||
|
|
|
@ -863,7 +863,7 @@ dtable::fixup_after_exec ()
|
||||||
/* Close the handle if it's close-on-exec or if an error was detected
|
/* 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.
|
(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);
|
fixup_close (i, fh);
|
||||||
else if (fh->get_popen_pid ())
|
else if (fh->get_popen_pid ())
|
||||||
close (i);
|
close (i);
|
||||||
|
@ -885,7 +885,7 @@ dtable::fixup_after_fork (HANDLE parent)
|
||||||
{
|
{
|
||||||
debug_printf ("fd %d (%s)", i, fh->get_name ());
|
debug_printf ("fd %d (%s)", i, fh->get_name ());
|
||||||
fh->fixup_after_fork (parent);
|
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
|
/* This should actually never happen but it's here to make sure
|
||||||
we don't crash due to access of an unopened file handle. */
|
we don't crash due to access of an unopened file handle. */
|
||||||
|
|
|
@ -241,20 +241,13 @@ class fhandler_base
|
||||||
|
|
||||||
IMPLEMENT_STATUS_FLAG (bool, wbinset)
|
IMPLEMENT_STATUS_FLAG (bool, wbinset)
|
||||||
IMPLEMENT_STATUS_FLAG (bool, rbinset)
|
IMPLEMENT_STATUS_FLAG (bool, rbinset)
|
||||||
|
IMPLEMENT_STATUS_FLAG (bool, nohandle)
|
||||||
IMPLEMENT_STATUS_FLAG (bool, did_lseek)
|
IMPLEMENT_STATUS_FLAG (bool, did_lseek)
|
||||||
IMPLEMENT_STATUS_FLAG (query_state, query_open)
|
IMPLEMENT_STATUS_FLAG (query_state, query_open)
|
||||||
IMPLEMENT_STATUS_FLAG (bool, close_on_exec)
|
IMPLEMENT_STATUS_FLAG (bool, close_on_exec)
|
||||||
IMPLEMENT_STATUS_FLAG (bool, need_fork_fixup)
|
IMPLEMENT_STATUS_FLAG (bool, need_fork_fixup)
|
||||||
IMPLEMENT_STATUS_FLAG (bool, isclosed)
|
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);
|
int get_default_fmode (int flags);
|
||||||
|
|
||||||
virtual void set_close_on_exec (bool val);
|
virtual void set_close_on_exec (bool val);
|
||||||
|
|
|
@ -19,6 +19,9 @@ details. */
|
||||||
#include "pinfo.h"
|
#include "pinfo.h"
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "cygtls.h"
|
#include "cygtls.h"
|
||||||
|
#include "dtable.h"
|
||||||
|
#include "cygheap.h"
|
||||||
|
#include "child_info.h"
|
||||||
#include "ntdll.h"
|
#include "ntdll.h"
|
||||||
|
|
||||||
/* Common functions shared by tty/console */
|
/* 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
|
/* 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
|
be NULL while this is alive. However, we can conceivably close a
|
||||||
ctty while exiting and that will zero this. */
|
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);
|
tcflush (TCIFLUSH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue