summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin
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
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')
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/dtable.cc2
-rw-r--r--winsup/cygwin/fhandler_console.cc6
3 files changed, 9 insertions, 5 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 9043b7d93..fcc1d11f8 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -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>
* hookapi.cc (find_first_notloaded_dll): Fix a compiler warning.
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index 612506e0c..7f414accc 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -478,7 +478,7 @@ fh_alloc (path_conv& pc)
fh = cnew (fhandler_console, pc.dev);
break;
default:
- switch ((int) pc.dev)
+ switch ((DWORD) pc.dev)
{
case FH_CONSOLE:
case FH_CONIN:
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 ();
}