diff options
author | Ron Yorston <rmy@pobox.com> | 2024-10-12 09:46:24 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2024-10-12 09:46:24 +0100 |
commit | 8db590e2431a18628a693d49e943d2c4d94cb85c (patch) | |
tree | fccfcb47a1dcfe49ed7ea85bfc7ef39d6f15abe6 | |
parent | 4bdeee55c1c2a456cae12abdff775fc60903bd6f (diff) | |
download | busybox-w32-8db590e2431a18628a693d49e943d2c4d94cb85c.tar.gz busybox-w32-8db590e2431a18628a693d49e943d2c4d94cb85c.tar.bz2 busybox-w32-8db590e2431a18628a693d49e943d2c4d94cb85c.zip |
kill: fix regression in 'kill -9'
'kill -9' was found to fail with an 'Invalid argument' error.
This is a regression introduced by commit 569de936a (kill: killing
a zombie process should fail).
Use the correct argument to OpenProcess() for SIGKILL so it can
query the exit code of the target process.
Adds 16 bytes.
(GitHub issue #465)
-rw-r--r-- | win32/process.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/win32/process.c b/win32/process.c index 34ef3cffa..30739c96d 100644 --- a/win32/process.c +++ b/win32/process.c | |||
@@ -822,15 +822,16 @@ static int kill_signal(pid_t pid, int sig) | |||
822 | { | 822 | { |
823 | HANDLE process; | 823 | HANDLE process; |
824 | int ret = 0; | 824 | int ret = 0; |
825 | DWORD code; | 825 | DWORD code, flags; |
826 | 826 | ||
827 | if (sig == SIGKILL) | 827 | if (sig == SIGKILL) |
828 | process = OpenProcess(PROCESS_TERMINATE, FALSE, pid); | 828 | flags = PROCESS_TERMINATE | PROCESS_QUERY_INFORMATION; |
829 | else | 829 | else |
830 | process = OpenProcess(SYNCHRONIZE | PROCESS_CREATE_THREAD | | 830 | flags = SYNCHRONIZE | PROCESS_CREATE_THREAD | |
831 | PROCESS_QUERY_INFORMATION | | 831 | PROCESS_QUERY_INFORMATION | |
832 | PROCESS_VM_OPERATION | PROCESS_VM_WRITE | | 832 | PROCESS_VM_OPERATION | PROCESS_VM_WRITE | |
833 | PROCESS_VM_READ, FALSE, pid); | 833 | PROCESS_VM_READ; |
834 | process = OpenProcess(flags, FALSE, pid); | ||
834 | 835 | ||
835 | if (!process) | 836 | if (!process) |
836 | return -1; | 837 | return -1; |