core/service: do not pass $MANAGERPID and friends if pidns is employed

This commit is contained in:
Mike Yuan
2025-11-05 17:28:44 +01:00
parent dfb4b39d4d
commit 675a4841cc
+3 -1
View File
@@ -1810,7 +1810,9 @@ static int service_spawn_internal(
return -ENOMEM;
}
if (MANAGER_IS_USER(UNIT(s)->manager)) {
if (MANAGER_IS_USER(UNIT(s)->manager) &&
!exec_needs_pid_namespace(&s->exec_context, /* params = */ NULL)) {
if (asprintf(our_env + n_env++, "MANAGERPID="PID_FMT, getpid_cached()) < 0)
return -ENOMEM;