https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=97d254c04b0f4e8228420bd5b57ab30d66a928b7

commit 97d254c04b0f4e8228420bd5b57ab30d66a928b7
Author: Takashi Yano <[email protected]>
Date:   Thu Dec 18 11:05:48 2025 +0900

    Cygwin: termios: Make is_console_app() return true for unknown
    
    If is_console_app() returns false, it means the app is GUI. In this case,
    standard handles would not be setup for non-cygwin app. Therefore, it is
    safer to return true for unknown case. Setting-up standard handles for
    GUI apps is pointless indeed, but not unsafe.
    
    Fixes: bb4285206207 ("Cygwin: pty: Implement new pseudo console support.")
    Reviewed-by: Johannes Schindelin <[email protected]>
    Signed-off-by: Takashi Yano <[email protected]>
    (cherry picked from commit d9bbeb69ba8b5c0eeb294ff665e16cba7039a5df)

Diff:
---
 winsup/cygwin/fhandler/termios.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/fhandler/termios.cc 
b/winsup/cygwin/fhandler/termios.cc
index a3cecdb6f..645aa1afa 100644
--- a/winsup/cygwin/fhandler/termios.cc
+++ b/winsup/cygwin/fhandler/termios.cc
@@ -719,7 +719,9 @@ is_console_app (const WCHAR *filename)
   wchar_t *e = wcsrchr (filename, L'.');
   if (e && (wcscasecmp (e, L".bat") == 0 || wcscasecmp (e, L".cmd") == 0))
     return true;
-  return false;
+  /* Return true for unknown to avoid standard handles from being unset.
+     Setting-up standard handles for GUI apps is pointless, but not unsafe. */
+  return true;
 }
 
 int

Reply via email to