From: Peter Foley <[email protected]> Avoid killing qemu if passt failed before writing a pidfile.
pid is initialized to 0, so calling pid in this scenario would kill the entire process group. Reviewed-by: Laurent Vivier <[email protected]> Signed-off-by: Peter Foley <[email protected]> Message-ID: <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]> --- net/passt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/passt.c b/net/passt.c index 9ed811a5142..b3d4b713140 100644 --- a/net/passt.c +++ b/net/passt.c @@ -102,7 +102,9 @@ static void net_passt_cleanup(NetClientState *nc) } #endif - kill(s->pid, SIGTERM); + if (s->pid > 0) { + kill(s->pid, SIGTERM); + } if (g_remove(s->pidfile) != 0) { warn_report("Failed to remove passt pidfile %s: %s", s->pidfile, strerror(errno)); -- 2.53.0
