From 0790f4e45f2f8c094bf929aa1fcaf4c7e9dbb001 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 27 Nov 2024 10:26:04 +0100 Subject: [PATCH] nspawn: don't try to unregister a machine we never registered When registering we condition this on "arg_register". Let's do the same when unregistering, otherwise we might end up trying to unregister a machine we never registered. --- src/nspawn/nspawn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 91700d92827..81531ac173f 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -5772,7 +5772,7 @@ static int run_container( r = wait_for_container(TAKE_PID(*pid), &container_status); /* Tell machined that we are gone. */ - if (bus) + if (arg_register && bus) (void) unregister_machine(bus, arg_machine); if (r < 0)