}
}
+inline void
+fhandler_pty_slave::free_attached_console ()
+{
+ if (freeconsole_on_close && get_minor () == pcon_attached_to)
+ {
+ FreeConsole ();
+ pcon_attached_to = -1;
+ }
+}
+
#define DEF_HOOK(name) static __typeof__ (name) *name##_Orig
DEF_HOOK (WriteFile);
DEF_HOOK (WriteConsoleA);
if (!get_ttyp ())
{
/* Why comes here? Who clears _tc? */
- if (freeconsole_on_close)
- {
- FreeConsole ();
- pcon_attached_to = -1;
- }
+ free_attached_console ();
return;
}
if (get_pseudo_console ())
if (used == 0)
{
init_console_handler (false);
- if (freeconsole_on_close)
- {
- FreeConsole ();
- pcon_attached_to = -1;
- }
+ free_attached_console ();
}
}
}
if (used == 1 /* About to close this tty */)
{
init_console_handler (false);
- if (freeconsole_on_close)
- {
- FreeConsole ();
- pcon_attached_to = -1;
- }
+ free_attached_console ();
}
}