DeduplicateStdioHandles() should inherit

The duplicated handles in DeduplicateStdioHandles() should
be inheritable. Otherwise sys_fork_nt_parent() will pass
non-inheritable handles to CreateProcess().
This commit is contained in:
hsfzxjy 2025-07-20 00:56:32 +08:00
parent f1e83d5240
commit 61d5df6e6d
No known key found for this signature in database
GPG key ID: 279C22B7DBCCFB94

View file

@ -147,7 +147,7 @@ abi static void DeduplicateStdioHandles(void) {
int64_t h2 = __imp_GetStdHandle(kNtStdio[j]);
if (h1 == h2) {
int64_t h3;
__imp_DuplicateHandle(-1, h2, -1, &h3, 0, false,
__imp_DuplicateHandle(-1, h2, -1, &h3, 0, true,
kNtDuplicateSameAccess);
__imp_SetStdHandle(kNtStdio[j], h3);
}