diff options
author | Jan Dubois <jand@activestate.com> | 2007-04-16 10:35:48 -0700 |
---|---|---|
committer | Steve Hay <SteveHay@planit.com> | 2007-04-17 11:13:23 +0000 |
commit | 6a4d57af77741d18e3b216914b61b40c34718dfc (patch) | |
tree | 116c4f0de5c2a9653e215aaf68c42981a255f49b | |
parent | 423b73760d999602951a3f5d94d4897cf8afc306 (diff) | |
download | perl-6a4d57af77741d18e3b216914b61b40c34718dfc.tar.gz |
Fix kill(0, $pid) on Windows
From: "Jan Dubois" <jand@activestate.com>
Message-ID: <01df01c78088$59718d30$0c54a790$@com>
Fixes breakage caused by #29605.
p4raw-id: //depot/perl@30970
-rw-r--r-- | win32/win32.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/win32/win32.c b/win32/win32.c index 4337256b14..55239e53e0 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); } |