aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2017-09-26 09:38:47 +0100
committerRon Yorston <rmy@pobox.com>2017-09-26 09:38:47 +0100
commit771dd3e88dad3030b5e1ebce9936bb600d4b567a (patch)
tree7f5602c53ff0ed0242aabe32820a606840d9813e
parentc8544e127085b79891003af39d32e4b89c54aab4 (diff)
downloadbusybox-w32-771dd3e88dad3030b5e1ebce9936bb600d4b567a.tar.gz
busybox-w32-771dd3e88dad3030b5e1ebce9936bb600d4b567a.tar.bz2
busybox-w32-771dd3e88dad3030b5e1ebce9936bb600d4b567a.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
-rw-r--r--win32/process.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/win32/process.c b/win32/process.c
index db2cf87d1..16a2acc6e 100644
--- a/win32/process.c
+++ b/win32/process.c
@@ -576,6 +576,18 @@ static int terminate_process(pid_t pid, int exit_code)
576 return ret; 576 return ret;
577} 577}
578 578
579static int test_process(pid_t pid, int exit_code)
580{
581 HANDLE process;
582
583 if (!(process=OpenProcess(PROCESS_TERMINATE, FALSE, pid))) {
584 return -1;
585 }
586
587 CloseHandle(process);
588 return 0;
589}
590
579int kill(pid_t pid, int sig) 591int kill(pid_t pid, int sig)
580{ 592{
581 if (sig == SIGTERM) { 593 if (sig == SIGTERM) {
@@ -584,6 +596,9 @@ int kill(pid_t pid, int sig)
584 else if (sig == SIGKILL) { 596 else if (sig == SIGKILL) {
585 return kill_pids(pid, 128+sig, terminate_process); 597 return kill_pids(pid, 128+sig, terminate_process);
586 } 598 }
599 else if (sig == 0) {
600 return kill_pids(pid, 128+sig, test_process);
601 }
587 602
588 errno = EINVAL; 603 errno = EINVAL;
589 return -1; 604 return -1;