diff options
author | Christopher Faylor <me@cgf.cx> | 2005-11-14 05:36:16 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2005-11-14 05:36:16 +0000 |
commit | 5a0826c3f84178498d91cd703d97791a691f6b30 (patch) | |
tree | c22575ad34b31a92cad5a2448368327603a63b1d /winsup/cygwin/fhandler_console.cc | |
parent | 59297e046420341bea04797159ee62b544c2295d (diff) | |
download | cygnal-5a0826c3f84178498d91cd703d97791a691f6b30.tar.gz cygnal-5a0826c3f84178498d91cd703d97791a691f6b30.tar.bz2 cygnal-5a0826c3f84178498d91cd703d97791a691f6b30.zip |
* fhandler.h (fhandler_console::fixup_after_fork_exec): Declare new function.
(fhandler_console::fixup_after_fork): Use fixup_after_fork_exec.
(fhandler_console::fixup_after_exec): Ditto.
* fhandler_console.cc (fhandler_console::fixup_after_fork): Delete definition.
(fhandler_console::fixup_after_fork_exec): Rename from fixup_after_exec.
* pinfo.cc (_pinfo::set_ctty): Don't play with console count here.
* syscalls.cc (close_all_files): Don't close cygheap ctty if hExeced since the
child will be copying information from us.
(setsid): Use myctty() rather than raw ctty #.
Diffstat (limited to 'winsup/cygwin/fhandler_console.cc')
-rw-r--r-- | winsup/cygwin/fhandler_console.cc | 38 |
1 files changed, 6 insertions, 32 deletions
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index a8c73d618..3c812ce33 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -695,10 +695,7 @@ fhandler_console::close () return 0; } -/* - * Special console dup to duplicate input and output - * handles. - */ +/* Special console dup to duplicate input and output handles. */ int fhandler_console::dup (fhandler_base *child) @@ -1757,29 +1754,6 @@ fhandler_console::set_close_on_exec (bool val) set_no_inheritance (output_handle, val); } -void -fhandler_console::fixup_after_fork (HANDLE) -{ - HANDLE h = get_handle (); - HANDLE oh = get_output_handle (); - - /* Windows does not allow duplication of console handles between processes - so open the console explicitly. */ - - if (!open (O_NOCTTY | get_flags (), 0)) - system_printf ("error opening console after fork, %E"); - - /* Need to decrement console_count since this open is basically a no-op to reopen - the console and we've already recorded that fact. */ - cygheap->manage_console_count ("fhandler_console::fixup_after_fork", -1); - - if (!close_on_exec ()) - { - CloseHandle (h); - CloseHandle (oh); - } -} - void __stdcall set_console_title (char *title) { @@ -1795,29 +1769,29 @@ set_console_title (char *title) } void -fhandler_console::fixup_after_exec () +fhandler_console::fixup_after_fork_exec () { HANDLE h = get_handle (); HANDLE oh = get_output_handle (); if (close_on_exec () || open (O_NOCTTY | get_flags (), 0)) - cygheap->manage_console_count ("fhandler_console::fixup_after_exec", -1); + cygheap->manage_console_count ("fhandler_console::fixup_after_fork_exec", -1); else { bool sawerr = false; if (!get_io_handle ()) { - system_printf ("error opening input console handle after exec, errno %d, %E", get_errno ()); + system_printf ("error opening input console handle after fork/exec, errno %d, %E", get_errno ()); sawerr = true; } if (!get_output_handle ()) { - system_printf ("error opening output console handle after exec, errno %d, %E", get_errno ()); + system_printf ("error opening output console handle after fork/exec, errno %d, %E", get_errno ()); sawerr = true; } if (!sawerr) - system_printf ("error opening console after exec, errno %d, %E", get_errno ()); + system_printf ("error opening console after fork/exec, errno %d, %E", get_errno ()); } if (!close_on_exec ()) |