ryantimwilson / rpms / systemd

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