From: Bernhard Miklautz Date: Mon, 9 Feb 2015 13:07:14 +0000 (+0100) Subject: winpr/process: handle pids <= 0 X-Git-Tag: 2.0.0-beta1+android10~678^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=582856d14244b0e684bbc3e1b4c312a83dfeed0b;p=platform%2Fupstream%2Ffreerdp.git 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). --- diff --git a/winpr/libwinpr/thread/process.c b/winpr/libwinpr/thread/process.c index ab2aab4..cc53276 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))