diff options
| author | Eli Zaretskii | 2024-08-09 14:00:34 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2024-08-09 14:00:34 +0300 |
| commit | 944e45db53cb173c5eadd4794081c133e8649d67 (patch) | |
| tree | d41568f00c414ae900c7bf36087e0e47c2b2fbdc /src | |
| parent | de7de561e1e3a973581b6993b3cc0074ff0bf91c (diff) | |
| download | emacs-944e45db53cb173c5eadd4794081c133e8649d67.tar.gz emacs-944e45db53cb173c5eadd4794081c133e8649d67.zip | |
; * src/w32.c (init_ntproc): Fix formatting conventions in last change.
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32.c | 27 |
1 files changed, 16 insertions, 11 deletions
| @@ -10482,14 +10482,19 @@ init_ntproc (int dumping) | |||
| 10482 | { | 10482 | { |
| 10483 | 10483 | ||
| 10484 | #ifdef _UCRT | 10484 | #ifdef _UCRT |
| 10485 | /* For UCRT, the _fdopen will try to find free stream from | 10485 | /* The non-UCRT code below relies on MSVCRT-only behavior, whereby |
| 10486 | _IOB_ENTRIES (= 3), thus we can't reopen the standard handles | 10486 | _fdopen reuses the first unused FILE slot, whereas UCRT skips the |
| 10487 | with it. Using SetHandleInformation to make the handle not | 10487 | first 3 slots, which correspond to stdin/stdout/stderr. That |
| 10488 | inheritable to child process is a better way. */ | 10488 | makes it impossible in the UCRT build to open these 3 streams |
| 10489 | SetHandleInformation (GetStdHandle(STD_INPUT_HANDLE), HANDLE_FLAG_INHERIT, 0); | 10489 | once they are closed. So we use SetHandleInformation instead, |
| 10490 | SetHandleInformation (GetStdHandle(STD_OUTPUT_HANDLE), HANDLE_FLAG_INHERIT, 0); | 10490 | which is available on all versions of Windows that have UCRT. */ |
| 10491 | SetHandleInformation (GetStdHandle(STD_ERROR_HANDLE), HANDLE_FLAG_INHERIT, 0); | 10491 | SetHandleInformation (GetStdHandle(STD_INPUT_HANDLE), |
| 10492 | #else | 10492 | HANDLE_FLAG_INHERIT, 0); |
| 10493 | SetHandleInformation (GetStdHandle(STD_OUTPUT_HANDLE), | ||
| 10494 | HANDLE_FLAG_INHERIT, 0); | ||
| 10495 | SetHandleInformation (GetStdHandle(STD_ERROR_HANDLE), | ||
| 10496 | HANDLE_FLAG_INHERIT, 0); | ||
| 10497 | #else /* !_UCRT */ | ||
| 10493 | HANDLE parent; | 10498 | HANDLE parent; |
| 10494 | HANDLE stdin_save = INVALID_HANDLE_VALUE; | 10499 | HANDLE stdin_save = INVALID_HANDLE_VALUE; |
| 10495 | HANDLE stdout_save = INVALID_HANDLE_VALUE; | 10500 | HANDLE stdout_save = INVALID_HANDLE_VALUE; |
| @@ -10497,8 +10502,8 @@ init_ntproc (int dumping) | |||
| 10497 | 10502 | ||
| 10498 | parent = GetCurrentProcess (); | 10503 | parent = GetCurrentProcess (); |
| 10499 | 10504 | ||
| 10500 | /* ignore errors when duplicating and closing; typically the | 10505 | /* Ignore errors when duplicating and closing; typically the |
| 10501 | handles will be invalid when running as a gui program. */ | 10506 | handles will be invalid when running as a gui program. */ |
| 10502 | DuplicateHandle (parent, | 10507 | DuplicateHandle (parent, |
| 10503 | GetStdHandle (STD_INPUT_HANDLE), | 10508 | GetStdHandle (STD_INPUT_HANDLE), |
| 10504 | parent, | 10509 | parent, |
| @@ -10544,7 +10549,7 @@ init_ntproc (int dumping) | |||
| 10544 | else | 10549 | else |
| 10545 | _open ("nul", O_TEXT | O_NOINHERIT | O_WRONLY); | 10550 | _open ("nul", O_TEXT | O_NOINHERIT | O_WRONLY); |
| 10546 | _fdopen (2, "w"); | 10551 | _fdopen (2, "w"); |
| 10547 | #endif | 10552 | #endif /* !_UCRT */ |
| 10548 | } | 10553 | } |
| 10549 | 10554 | ||
| 10550 | /* unfortunately, atexit depends on implementation of malloc */ | 10555 | /* unfortunately, atexit depends on implementation of malloc */ |