Previously, process_fd did not handle fhandler using archetype
correctly. Due to lack of PC_OPEN flag for path_conv, build_fh_pc()
could not initialize archetype. Because of this bug, accessing pty
or console via process_fd fails.

With this patch, use build_fh_name() with PC_OPEN flag instead of
build_fh_pc() to set PC_OPEN flag to path_conv.

Addresses: https://cygwin.com/pipermail/cygwin/2025-May/258167.html
Fixes: 7aca27b4fe55 ("Cygwin: introduce fhandler_process_fd and add stat(2) 
handling")
Reported-by: Christian Franke <christian.fra...@t-online.de>
Reviewed-by:
Signed-off-by: Takashi Yano <takashi.y...@nifty.ne.jp>
---
 winsup/cygwin/fhandler/process_fd.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/fhandler/process_fd.cc 
b/winsup/cygwin/fhandler/process_fd.cc
index d81495103..14ae8746a 100644
--- a/winsup/cygwin/fhandler/process_fd.cc
+++ b/winsup/cygwin/fhandler/process_fd.cc
@@ -97,7 +97,7 @@ fhandler_process_fd::fetch_fh (HANDLE &out_hdl, uint32_t 
flags)
              pc.get_posix ());
       pc.set_posix (fullpath);
     }
-  fhandler_base *fh = build_fh_pc (pc);
+  fhandler_base *fh = build_fh_name (pc.get_posix (), PC_OPEN);
   if (!fh)
     {
       CloseHandle (hdl);
-- 
2.45.1

Reply via email to