valeriyvdovin / rpms / systemd

Forked from rpms/systemd 4 years ago
Clone
ff2b41
From 0e6f66ae4853b0e7c99f415b14ecfefb752d51ca Mon Sep 17 00:00:00 2001
ff2b41
From: Lennart Poettering <lennart@poettering.net>
ff2b41
Date: Thu, 18 Feb 2016 22:51:23 +0100
ff2b41
Subject: [PATCH] core: exclude .slice units from "systemctl isolate"
ff2b41
ff2b41
Fixes: #1969
ff2b41
(cherry picked from commit 1b4cd0cf11feb7d41f2eff17f86fa55b31bb6841)
ff2b41
ff2b41
Resolves: #1745199
ff2b41
---
ff2b41
 src/core/slice.c | 8 ++++++++
ff2b41
 1 file changed, 8 insertions(+)
ff2b41
ff2b41
diff --git a/src/core/slice.c b/src/core/slice.c
ff2b41
index 0985a65286..b0769205f6 100644
ff2b41
--- a/src/core/slice.c
ff2b41
+++ b/src/core/slice.c
ff2b41
@@ -36,6 +36,13 @@ static const UnitActiveState state_translation_table[_SLICE_STATE_MAX] = {
ff2b41
         [SLICE_ACTIVE] = UNIT_ACTIVE
ff2b41
 };
ff2b41
 
ff2b41
+static void slice_init(Unit *u) {
ff2b41
+        assert(u);
ff2b41
+        assert(u->load_state == UNIT_STUB);
ff2b41
+
ff2b41
+        u->ignore_on_isolate = true;
ff2b41
+}
ff2b41
+
ff2b41
 static void slice_set_state(Slice *t, SliceState state) {
ff2b41
         SliceState old_state;
ff2b41
         assert(t);
ff2b41
@@ -274,6 +281,7 @@ const UnitVTable slice_vtable = {
ff2b41
         .no_instances = true,
ff2b41
         .can_transient = true,
ff2b41
 
ff2b41
+        .init = slice_init,
ff2b41
         .load = slice_load,
ff2b41
 
ff2b41
         .coldplug = slice_coldplug,