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.
Signed-off-by: Peter Foley <[email protected]> --- net/passt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/passt.c b/net/passt.c index 9ed811a514..b3d4b71314 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.371.g1d285c8824-goog
