libcamera: process: Fix killing innocent processes unexpectedly
When a libcamera::process is being destructed or called kill() without a previous successful call to start(), it's pid_ may remains -1, which causes all the killable processes being killed when passed to `kill(pid_, SIG_KILL)`. Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
committed by
Laurent Pinchart
parent
256845d5b7
commit
774f0d1b9b
@@ -373,7 +373,8 @@ void Process::died(int wstatus)
|
||||
*/
|
||||
void Process::kill()
|
||||
{
|
||||
::kill(pid_, SIGKILL);
|
||||
if (pid_ > 0)
|
||||
::kill(pid_, SIGKILL);
|
||||
}
|
||||
|
||||
} /* namespace libcamera */
|
||||
|
||||
Reference in New Issue
Block a user