From 6a3dce08b34f92843f8f92f51aaf56e55e148b89 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Tue, 26 Sep 2017 09:38:47 +0100 Subject: 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 --- win32/process.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'win32') 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) return ret; } +static int test_process(pid_t pid, int exit_code UNUSED_PARAM) +{ + HANDLE process; + + if (!(process=OpenProcess(PROCESS_TERMINATE, FALSE, pid))) { + return -1; + } + + CloseHandle(process); + return 0; +} + int kill(pid_t pid, int sig) { if (sig == SIGTERM) { @@ -595,6 +607,9 @@ int kill(pid_t pid, int sig) else if (sig == SIGKILL) { return kill_pids(pid, 128+sig, terminate_process); } + else if (sig == 0) { + return kill_pids(pid, 128+sig, test_process); + } errno = EINVAL; return -1; -- cgit v1.2.3-55-g6feb