run: do not munge user.slice with --slice-inherit

When using --slice-inherit, setting arg_slice would inadvertently munge
user.slice into the current user slice, usually producing a slice name
like user-1000-user.slice. This is treated as a user-UID slice by
user-.slice.d/10-defaults.conf, resulting in a strange description:
literally "User slice for UID user" (instead of an actual user UID).

Keep arg_slice empty when using --slice-inherit so that we actually
inherit from the relevant slice instead of a munged version.

Fixes: #42601
This commit is contained in:
Ronan Pigott
2026-06-30 09:51:05 +01:00
committed by Luca Boccassi
parent 8032290a98
commit 7eed8858d7
+1 -1
View File
@@ -1049,7 +1049,7 @@ static int parse_argv_sudo_mode(int argc, char *argv[]) {
strv_free_and_replace(arg_cmdline, l);
if (!arg_slice) {
if (!custom_slice) {
arg_slice = strdup(SPECIAL_USER_SLICE);
if (!arg_slice)
return log_oom();