Always clean up the systemd unit, even if it fails

This can occur if the child process exits before the dbus call in the
parent finishes, in which case the cgroup is unneeded.
pull/3514/head
yut23 2023-03-30 17:36:03 -04:00
parent 76dd6ffee9
commit 9737c947bc
1 changed files with 8 additions and 0 deletions

View File

@ -166,6 +166,14 @@ systemd_move_pid_to_new_cgroup(pid_t pid, char **cause)
goto finish;
}
/* clean up the scope even if it fails */
r = sd_bus_message_append(m, "(sv)", "CollectMode", "s", "inactive-or-failed");
if (r < 0) {
xasprintf(cause, "failed to append to properties: %s",
strerror(-r));
goto finish;
}
/* end properties array */
r = sd_bus_message_close_container(m);
if (r < 0) {