summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_console.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2012-03-10 17:51:33 +0000
committerChristopher Faylor <me@cgf.cx>2012-03-10 17:51:33 +0000
commit6c95669d23c27bad29a47a70ff2dec7136f6cdf6 (patch)
treedf8e8b1f102f71296658d3882475aad5749a9209 /winsup/cygwin/fhandler_console.cc
parentecd676f23c21e6bec1d3b8833bff6a1520751fce (diff)
downloadcygnal-6c95669d23c27bad29a47a70ff2dec7136f6cdf6.tar.gz
cygnal-6c95669d23c27bad29a47a70ff2dec7136f6cdf6.tar.bz2
cygnal-6c95669d23c27bad29a47a70ff2dec7136f6cdf6.zip
* 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.
Diffstat (limited to 'winsup/cygwin/fhandler_console.cc')
-rw-r--r--winsup/cygwin/fhandler_console.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 32454511a..a3553a728 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -134,6 +134,7 @@ fhandler_console::set_unit ()
{
bool created;
fh_devices devset;
+ lock_ttys here;
if (shared_console_info)
{
fh_devices this_unit = dev ();
@@ -152,10 +153,7 @@ fhandler_console::set_unit ()
shared_console_info = open_shared_console (me, cygheap->console_h, created);
ProtectHandleINH (cygheap->console_h);
if (created)
- {
- lock_ttys here;
- shared_console_info->tty_min_state.setntty (DEV_CONS_MAJOR, console_unit (me));
- }
+ shared_console_info->tty_min_state.setntty (DEV_CONS_MAJOR, console_unit (me));
devset = (fh_devices) shared_console_info->tty_min_state.getntty ();
}