@samitouri / QOSamiQemu / commits / d89f7c8194

net/passt: Don't try to read the pidfile if passt got a signal

g_subprocess_get_if_exited returns false if passt was killed by a signal, so we fall through to trying to read the pidfile. Update the error when passt exits to include the exit code. Reviewed-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: Peter Foley <pefoley@google.com> Message-ID: <20260305-passt-v2-2-f0582198afc0@google.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Peter Foley committed Mar 5, 2026 at 11:04 UTC d89f7c8194690ab5979ab4802de67e919126be9f
1 file changed +11 -2
net/passt.c
+11 -2
@@ -270,8 +270,17 @@ static int net_passt_start_daemon(NetPasstState *s, int sock, Error **errp)
270 return -1;
271 }
272
273 - if (g_subprocess_get_if_exited(daemon) &&
274 - g_subprocess_get_exit_status(daemon)) {
273 + if (g_subprocess_get_if_exited(daemon)) {
274 + gint status = g_subprocess_get_exit_status(daemon);
275 + if (status) {
276 + error_setg(errp, "Passt exited with code %d", status);
277 + return -1;
278 + }
279 + }
280 +
281 + if (g_subprocess_get_if_signaled(daemon)) {
282 + error_setg(errp, "Passt killed with signal %d",
283 + g_subprocess_get_term_sig(daemon));
284 return -1;
285 }
286