Skip to content

Commit b2414b8

Browse files
committed
revert #1595
1 parent c63369e commit b2414b8

File tree

2 files changed

+1
-13
lines changed

2 files changed

+1
-13
lines changed

HISTORY.rst

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ XXXX-XX-XX
99

1010
- 1179_: [Linux] Process cmdline() now takes into account misbehaving processes
1111
renaming the command line and using inappropriate chars to separate args.
12-
- 1595_: [Windows] Process.kill() may not throw AccessDenied.
1312
- 1616_: use of Py_DECREF instead of Py_CLEAR will result in double free and
1413
segfault (CVE). (patch by Riccardo Schirone)
1514
- 1619_: [OpenBSD] compilation fails due to C syntax error. (patch by Nathan

psutil/_psutil_windows.c

+1-12
Original file line numberDiff line numberDiff line change
@@ -267,25 +267,14 @@ psutil_proc_kill(PyObject *self, PyObject *args) {
267267
if (! TerminateProcess(hProcess, SIGTERM)) {
268268
// ERROR_ACCESS_DENIED may happen if the process already died. See:
269269
// https://github.com/giampaolo/psutil/issues/1099
270-
// https://github.com/giampaolo/psutil/issues/1595
271-
if ((GetLastError() == ERROR_ACCESS_DENIED) && \
272-
(psutil_pid_is_running(pid) == 0))
273-
{
274-
CloseHandle(hProcess);
275-
Py_RETURN_NONE;
276-
}
277-
else {
270+
if (GetLastError() != ERROR_ACCESS_DENIED) {
278271
PyErr_SetFromOSErrnoWithSyscall("TerminateProcess");
279272
goto error;
280273
}
281274
}
282275

283276
CloseHandle(hProcess);
284277
Py_RETURN_NONE;
285-
286-
error:
287-
CloseHandle(hProcess);
288-
return NULL;
289278
}
290279

291280

0 commit comments

Comments
 (0)