Skip to content

Commit

Permalink
revert #1595
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Nov 22, 2019
1 parent c63369e commit b2414b8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
1 change: 0 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ XXXX-XX-XX

- 1179_: [Linux] Process cmdline() now takes into account misbehaving processes
renaming the command line and using inappropriate chars to separate args.
- 1595_: [Windows] Process.kill() may not throw AccessDenied.
- 1616_: use of Py_DECREF instead of Py_CLEAR will result in double free and
segfault (CVE). (patch by Riccardo Schirone)
- 1619_: [OpenBSD] compilation fails due to C syntax error. (patch by Nathan
Expand Down
13 changes: 1 addition & 12 deletions psutil/_psutil_windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,25 +267,14 @@ psutil_proc_kill(PyObject *self, PyObject *args) {
if (! TerminateProcess(hProcess, SIGTERM)) {
// ERROR_ACCESS_DENIED may happen if the process already died. See:
// https://github.com/giampaolo/psutil/issues/1099
// https://github.com/giampaolo/psutil/issues/1595
if ((GetLastError() == ERROR_ACCESS_DENIED) && \
(psutil_pid_is_running(pid) == 0))
{
CloseHandle(hProcess);
Py_RETURN_NONE;
}
else {
if (GetLastError() != ERROR_ACCESS_DENIED) {
PyErr_SetFromOSErrnoWithSyscall("TerminateProcess");
goto error;
}
}

CloseHandle(hProcess);
Py_RETURN_NONE;

error:
CloseHandle(hProcess);
return NULL;
}


Expand Down

0 comments on commit b2414b8

Please sign in to comment.