diff options
author | Ron Yorston <rmy@pobox.com> | 2024-10-13 09:27:33 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2024-10-13 09:27:33 +0100 |
commit | 6af8061b6dfde7cf4e41a6da00bf91a7105a05eb (patch) | |
tree | 15cfb54fad57b700989b6face66b02ce614a4bed /win32 | |
parent | 8db590e2431a18628a693d49e943d2c4d94cb85c (diff) | |
download | busybox-w32-6af8061b6dfde7cf4e41a6da00bf91a7105a05eb.tar.gz busybox-w32-6af8061b6dfde7cf4e41a6da00bf91a7105a05eb.tar.bz2 busybox-w32-6af8061b6dfde7cf4e41a6da00bf91a7105a05eb.zip |
win32: close exec'ing process if possible
If a process performing an exec is an orphan there's no reason for
it to wait for its child's exit code. Let it exit immediately.
Adds 16 bytes.
(GitHub issue #461)
Diffstat (limited to 'win32')
-rw-r--r-- | win32/process.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/win32/process.c b/win32/process.c index 30739c96d..a70b9484e 100644 --- a/win32/process.c +++ b/win32/process.c | |||
@@ -487,6 +487,9 @@ static NORETURN void wait_for_child(HANDLE child, const char *cmd) | |||
487 | DWORD code; | 487 | DWORD code; |
488 | int status; | 488 | int status; |
489 | 489 | ||
490 | if (getppid() == 1) | ||
491 | exit(0); | ||
492 | |||
490 | kill_child_ctrl_handler(GetProcessId(child)); | 493 | kill_child_ctrl_handler(GetProcessId(child)); |
491 | SetConsoleCtrlHandler(kill_child_ctrl_handler, TRUE); | 494 | SetConsoleCtrlHandler(kill_child_ctrl_handler, TRUE); |
492 | WaitForSingleObject(child, INFINITE); | 495 | WaitForSingleObject(child, INFINITE); |