public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/cygwin-3_5-branch] Cygwin: console: Bug fix for the last console code change
@ 2024-07-06 15:30 Takashi Yano
0 siblings, 0 replies; only message in thread
From: Takashi Yano @ 2024-07-06 15:30 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=ec71ae7a4bb1324ece373f9b4d67d84eabf1d7c6
commit ec71ae7a4bb1324ece373f9b4d67d84eabf1d7c6
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date: Sun Jul 7 00:16:29 2024 +0900
Cygwin: console: Bug fix for the last console code change
The commit baf2764dca43 has a serious bug that shared_info_state is
common for all console devices despite it should be individual for
each console device. This patch fixes that.
Fixes: baf2764dca43 ("Cygwin: console: Fixes an issue that tmux can not run on the console.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Diff:
---
winsup/cygwin/fhandler/console.cc | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/winsup/cygwin/fhandler/console.cc b/winsup/cygwin/fhandler/console.cc
index a870b741c..6028559b2 100644
--- a/winsup/cygwin/fhandler/console.cc
+++ b/winsup/cygwin/fhandler/console.cc
@@ -49,7 +49,7 @@ details. */
#define con_is_legacy (shared_console_info[unit] && con.is_legacy)
static HANDLE NO_COPY shared_info_mutex;
-static int NO_COPY shared_info_state;
+static int NO_COPY shared_info_state[MAX_CONS_DEV];
#define CONS_THREAD_SYNC "cygcons.thread_sync"
static bool NO_COPY master_thread_started = false;
@@ -672,7 +672,6 @@ fhandler_console::set_unit ()
shared_info_mutex = CreateMutex (&sec_none_nih, FALSE, NULL);
WaitForSingleObject (shared_info_mutex, INFINITE);
- shared_info_state++;
if (shared_console_info[unit])
; /* Do nothing */
@@ -682,7 +681,10 @@ fhandler_console::set_unit ()
else
{
if (!generic_console && (dev_t) myself->ctty != get_device ())
- shared_console_info[unit] = console_unit (unit);
+ {
+ shared_console_info[unit] = console_unit (unit);
+ shared_info_state[unit]++;
+ }
if (generic_console || !shared_console_info[unit])
{
me = GetConsoleWindow ();
@@ -693,6 +695,7 @@ fhandler_console::set_unit ()
created = true;
fhandler_console::console_state *cs =
open_shared_console (me, cygheap->console_h, created);
+ shared_info_state[unit]++;
ProtectHandleINH (cygheap->console_h);
if (created)
{
@@ -1975,7 +1978,7 @@ fhandler_console::close ()
output_mutex = NULL;
WaitForSingleObject (shared_info_mutex, INFINITE);
- if (--shared_info_state == 0 && shared_console_info[unit])
+ if (--shared_info_state[unit] == 0 && shared_console_info[unit])
{
UnmapViewOfFile ((void *) shared_console_info[unit]);
shared_console_info[unit] = NULL;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-07-06 15:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-06 15:30 [newlib-cygwin/cygwin-3_5-branch] Cygwin: console: Bug fix for the last console code change Takashi Yano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).