From 5b94f99f10a11cd54ad306db7a2b57424a2d5321 Mon Sep 17 00:00:00 2001
From: Ben Gamari <ben@smart-cactus.org>
Date: Mon, 10 Mar 2025 20:33:16 -0400
Subject: [PATCH] rts: Ensure that WinIO flag is set when --io-manager=auto

As noted in #25838, previously `selectIOManager` failed to set
`rts_IOManagerIsWin32Native` in its `IO_MNGR_FLAG_AUTO`. This meant
that the MIO path was taken when WinIO was supposedly selected,
resulting in chaos.

Fixes #25838.
---
 rts/IOManager.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/rts/IOManager.c b/rts/IOManager.c
index d70713fa346..f2d7a60b935 100644
--- a/rts/IOManager.c
+++ b/rts/IOManager.c
@@ -233,7 +233,6 @@ void selectIOManager(void)
 #if defined(IOMGR_ENABLED_WINIO)
         case IO_MNGR_FLAG_WINIO:
             iomgr_type = IO_MANAGER_WINIO;
-            rts_IOManagerIsWin32Native = true;
             break;
 #endif
 
@@ -246,6 +245,10 @@ void selectIOManager(void)
         default:
           barf("selectIOManager: %d", RtsFlags.MiscFlags.ioManager);
     }
+
+#if defined(mingw32_HOST_OS)
+    rts_IOManagerIsWin32Native = iomgr_type == IO_MANAGER_WINIO;
+#endif
 }
 
 
-- 
GitLab