diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32.c | 11 |
1 files changed, 11 insertions, 0 deletions
| @@ -10480,6 +10480,16 @@ init_ntproc (int dumping) | |||
| 10480 | /* Initial preparation for subprocess support: replace our standard | 10480 | /* Initial preparation for subprocess support: replace our standard |
| 10481 | handles with non-inheritable versions. */ | 10481 | handles with non-inheritable versions. */ |
| 10482 | { | 10482 | { |
| 10483 | |||
| 10484 | #ifdef _UCRT | ||
| 10485 | /* For UCRT, the _fdopen will try to find free stream from | ||
| 10486 | _IOB_ENTRIES (= 3), thus we can't reopen the standard handles | ||
| 10487 | with it. Using SetHandleInformation to make the handle not | ||
| 10488 | inheritable to child process is a better way. */ | ||
| 10489 | SetHandleInformation (GetStdHandle(STD_INPUT_HANDLE), HANDLE_FLAG_INHERIT, 0); | ||
| 10490 | SetHandleInformation (GetStdHandle(STD_OUTPUT_HANDLE), HANDLE_FLAG_INHERIT, 0); | ||
| 10491 | SetHandleInformation (GetStdHandle(STD_ERROR_HANDLE), HANDLE_FLAG_INHERIT, 0); | ||
| 10492 | #else | ||
| 10483 | HANDLE parent; | 10493 | HANDLE parent; |
| 10484 | HANDLE stdin_save = INVALID_HANDLE_VALUE; | 10494 | HANDLE stdin_save = INVALID_HANDLE_VALUE; |
| 10485 | HANDLE stdout_save = INVALID_HANDLE_VALUE; | 10495 | HANDLE stdout_save = INVALID_HANDLE_VALUE; |
| @@ -10534,6 +10544,7 @@ init_ntproc (int dumping) | |||
| 10534 | else | 10544 | else |
| 10535 | _open ("nul", O_TEXT | O_NOINHERIT | O_WRONLY); | 10545 | _open ("nul", O_TEXT | O_NOINHERIT | O_WRONLY); |
| 10536 | _fdopen (2, "w"); | 10546 | _fdopen (2, "w"); |
| 10547 | #endif | ||
| 10537 | } | 10548 | } |
| 10538 | 10549 | ||
| 10539 | /* unfortunately, atexit depends on implementation of malloc */ | 10550 | /* unfortunately, atexit depends on implementation of malloc */ |