From 582856d14244b0e684bbc3e1b4c312a83dfeed0b Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Mon, 9 Feb 2015 14:07:14 +0100 Subject: [PATCH] winpr/process: handle pids <= 0 TerminateProcess shouldn't call kill if the PID is <=0 because this has unwanted effects (and is not what TerminateProcess should do): * with PID == 0 any process in the same process group gets the signal sent * with PID == -1 *every* processes that the running users has permissions to gets the signal sent * with PID < -1 the process within the same process group and -PID gets the signal send For more details see kill(2). --- winpr/libwinpr/thread/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winpr/libwinpr/thread/process.c b/winpr/libwinpr/thread/process.c index ab2aab41d..cc5327674 100644 --- a/winpr/libwinpr/thread/process.c +++ b/winpr/libwinpr/thread/process.c @@ -448,7 +448,7 @@ BOOL TerminateProcess(HANDLE hProcess, UINT uExitCode) process = (WINPR_PROCESS*) hProcess; - if (!process) + if (!process || (process->pid <= 0)) return FALSE; if (kill(process->pid, SIGTERM))