* dtable.cc (fh_alloc): Treat pc.dev as unsigned.

* fhandler_console.cc (fhandler_console::set_unit): Use lock always to avoid
races between competing cygwin processes running on the console.
This commit is contained in:
Christopher Faylor 2012-03-10 17:51:33 +00:00
parent ecd676f23c
commit 6c95669d23
3 changed files with 9 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2012-03-10 Christopher Faylor <me.cygwin2012@cgf.cx>
* dtable.cc (fh_alloc): Treat pc.dev as unsigned.
* fhandler_console.cc (fhandler_console::set_unit): Use lock always to
avoid races between competing cygwin processes running on the console.
2012-03-09 Corinna Vinschen <corinna@vinschen.de> 2012-03-09 Corinna Vinschen <corinna@vinschen.de>
* hookapi.cc (find_first_notloaded_dll): Fix a compiler warning. * hookapi.cc (find_first_notloaded_dll): Fix a compiler warning.

View File

@ -478,7 +478,7 @@ fh_alloc (path_conv& pc)
fh = cnew (fhandler_console, pc.dev); fh = cnew (fhandler_console, pc.dev);
break; break;
default: default:
switch ((int) pc.dev) switch ((DWORD) pc.dev)
{ {
case FH_CONSOLE: case FH_CONSOLE:
case FH_CONIN: case FH_CONIN:

View File

@ -134,6 +134,7 @@ fhandler_console::set_unit ()
{ {
bool created; bool created;
fh_devices devset; fh_devices devset;
lock_ttys here;
if (shared_console_info) if (shared_console_info)
{ {
fh_devices this_unit = dev (); fh_devices this_unit = dev ();
@ -152,10 +153,7 @@ fhandler_console::set_unit ()
shared_console_info = open_shared_console (me, cygheap->console_h, created); shared_console_info = open_shared_console (me, cygheap->console_h, created);
ProtectHandleINH (cygheap->console_h); ProtectHandleINH (cygheap->console_h);
if (created) if (created)
{ shared_console_info->tty_min_state.setntty (DEV_CONS_MAJOR, console_unit (me));
lock_ttys here;
shared_console_info->tty_min_state.setntty (DEV_CONS_MAJOR, console_unit (me));
}
devset = (fh_devices) shared_console_info->tty_min_state.getntty (); devset = (fh_devices) shared_console_info->tty_min_state.getntty ();
} }