From: Jan Dubois Date: Mon, 16 Apr 2007 17:35:48 +0000 (-0700) Subject: Fix kill(0, $pid) on Windows X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6a4d57af77741d18e3b216914b61b40c34718dfc;p=p5sagit%2Fp5-mst-13.2.git Fix kill(0, $pid) on Windows From: "Jan Dubois" Message-ID: <01df01c78088$59718d30$0c54a790$@com> Fixes breakage caused by #29605. p4raw-id: //depot/perl@30970 --- diff --git a/win32/win32.c b/win32/win32.c index 4337256..55239e5 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1218,7 +1218,7 @@ kill_process_tree_toolhelp(DWORD pid, int sig) int killed = 0; process_handle = OpenProcess(PROCESS_TERMINATE, FALSE, pid); - if (process_handle == INVALID_HANDLE_VALUE) + if (process_handle == NULL) return 0; killed += terminate_process(pid, process_handle, sig); @@ -1253,7 +1253,7 @@ kill_process_tree_sysinfo(SYSTEM_PROCESSES *process_info, DWORD pid, int sig) int killed = 0; process_handle = OpenProcess(PROCESS_TERMINATE, FALSE, pid); - if (process_handle == INVALID_HANDLE_VALUE) + if (process_handle == NULL) return 0; killed += terminate_process(pid, process_handle, sig); @@ -1308,7 +1308,8 @@ my_kill(int pid, int sig) return killpg(pid, -sig); process_handle = OpenProcess(PROCESS_TERMINATE, FALSE, pid); - if (process_handle != INVALID_HANDLE_VALUE) { + /* OpenProcess() returns NULL on error, *not* INVALID_HANDLE_VALUE */ + if (process_handle != NULL) { retval = terminate_process(pid, process_handle, sig); CloseHandle(process_handle); }