diff options
author | Ron Yorston <rmy@pobox.com> | 2017-09-26 09:38:47 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2017-09-27 08:42:36 +0100 |
commit | 6a3dce08b34f92843f8f92f51aaf56e55e148b89 (patch) | |
tree | dab127e4f047a8bc7bb4397fb1e7551929d18ae8 /win32 | |
parent | 9da9454f418db5424357cef80b681eab22fc4379 (diff) | |
download | busybox-w32-6a3dce08b34f92843f8f92f51aaf56e55e148b89.tar.gz busybox-w32-6a3dce08b34f92843f8f92f51aaf56e55e148b89.tar.bz2 busybox-w32-6a3dce08b34f92843f8f92f51aaf56e55e148b89.zip |
win32: allow kill to send signal number 0
According to the man page:
If sig is 0, then no signal is sent, but existence and permission
checks are still performed
Diffstat (limited to 'win32')
-rw-r--r-- | win32/process.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/win32/process.c b/win32/process.c index ada0d743f..9ad75f94f 100644 --- a/win32/process.c +++ b/win32/process.c | |||
@@ -587,6 +587,18 @@ static int terminate_process(pid_t pid, int exit_code) | |||
587 | return ret; | 587 | return ret; |
588 | } | 588 | } |
589 | 589 | ||
590 | static int test_process(pid_t pid, int exit_code UNUSED_PARAM) | ||
591 | { | ||
592 | HANDLE process; | ||
593 | |||
594 | if (!(process=OpenProcess(PROCESS_TERMINATE, FALSE, pid))) { | ||
595 | return -1; | ||
596 | } | ||
597 | |||
598 | CloseHandle(process); | ||
599 | return 0; | ||
600 | } | ||
601 | |||
590 | int kill(pid_t pid, int sig) | 602 | int kill(pid_t pid, int sig) |
591 | { | 603 | { |
592 | if (sig == SIGTERM) { | 604 | if (sig == SIGTERM) { |
@@ -595,6 +607,9 @@ int kill(pid_t pid, int sig) | |||
595 | else if (sig == SIGKILL) { | 607 | else if (sig == SIGKILL) { |
596 | return kill_pids(pid, 128+sig, terminate_process); | 608 | return kill_pids(pid, 128+sig, terminate_process); |
597 | } | 609 | } |
610 | else if (sig == 0) { | ||
611 | return kill_pids(pid, 128+sig, test_process); | ||
612 | } | ||
598 | 613 | ||
599 | errno = EINVAL; | 614 | errno = EINVAL; |
600 | return -1; | 615 | return -1; |