Cygwin: pty: Fix state mismatch caused in mintty.
- PTY has a bug reported in: https://cygwin.com/ml/cygwin/2020-02/msg00067.html. This is the result of state mismatch between real pseudo console attaching state and state variable. This patch fixes the issue.
This commit is contained in:
		
				
					committed by
					
						 Corinna Vinschen
						Corinna Vinschen
					
				
			
			
				
	
			
			
			
						parent
						
							29431fcb5b
						
					
				
				
					commit
					2de74af22b
				
			| @@ -65,6 +65,12 @@ static bool isHybrid; | |||||||
| static bool do_not_reset_switch_to_pcon; | static bool do_not_reset_switch_to_pcon; | ||||||
| static bool freeconsole_on_close = true; | static bool freeconsole_on_close = true; | ||||||
|  |  | ||||||
|  | void | ||||||
|  | clear_pcon_attached_to (void) | ||||||
|  | { | ||||||
|  |   pcon_attached_to = -1; | ||||||
|  | } | ||||||
|  |  | ||||||
| static void | static void | ||||||
| set_switch_to_pcon (void) | set_switch_to_pcon (void) | ||||||
| { | { | ||||||
| @@ -727,7 +733,10 @@ fhandler_pty_slave::~fhandler_pty_slave () | |||||||
| 	{ | 	{ | ||||||
| 	  init_console_handler (false); | 	  init_console_handler (false); | ||||||
| 	  if (freeconsole_on_close) | 	  if (freeconsole_on_close) | ||||||
| 	    FreeConsole (); | 	    { | ||||||
|  | 	      FreeConsole (); | ||||||
|  | 	      pcon_attached_to = -1; | ||||||
|  | 	    } | ||||||
| 	} | 	} | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -2988,7 +2997,10 @@ fhandler_pty_slave::fixup_after_exec () | |||||||
| 	{ | 	{ | ||||||
| 	  init_console_handler (false); | 	  init_console_handler (false); | ||||||
| 	  if (freeconsole_on_close) | 	  if (freeconsole_on_close) | ||||||
| 	    FreeConsole (); | 	    { | ||||||
|  | 	      FreeConsole (); | ||||||
|  | 	      pcon_attached_to = -1; | ||||||
|  | 	    } | ||||||
| 	} | 	} | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -161,6 +161,8 @@ frok::child (volatile char * volatile here) | |||||||
| 	      } | 	      } | ||||||
| 	  } | 	  } | ||||||
|       } |       } | ||||||
|  |   extern void clear_pcon_attached_to (void); /* fhandler_tty.cc */ | ||||||
|  |   clear_pcon_attached_to (); | ||||||
|  |  | ||||||
|   HANDLE& hParent = ch.parent; |   HANDLE& hParent = ch.parent; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user