Blame SOURCES/0360-core-don-t-allow-enabling-if-unit-is-masked.patch
|
|
84b277 |
From 0fb9d07643a9e9e84c61a6a62f4c2b7d52e4d96f Mon Sep 17 00:00:00 2001
|
|
|
84b277 |
From: Jan Synacek <jsynacek@redhat.com>
|
|
|
84b277 |
Date: Tue, 7 Oct 2014 13:27:38 +0200
|
|
|
84b277 |
Subject: [PATCH] core: don't allow enabling if unit is masked
|
|
|
84b277 |
|
|
|
84b277 |
(cherry-picked from f7101b7368dfe41dbc8b7203e06133cccb589c01)
|
|
|
84b277 |
|
|
|
84b277 |
Resolves: #1149299
|
|
|
84b277 |
---
|
|
|
84b277 |
src/shared/install.c | 13 +++++++++++++
|
|
|
84b277 |
1 file changed, 13 insertions(+)
|
|
|
84b277 |
|
|
|
84b277 |
diff --git a/src/shared/install.c b/src/shared/install.c
|
|
|
84b277 |
index 1662c5f..7a29798 100644
|
|
|
84b277 |
--- a/src/shared/install.c
|
|
|
84b277 |
+++ b/src/shared/install.c
|
|
|
84b277 |
@@ -1520,6 +1520,19 @@ int unit_file_enable(
|
|
|
84b277 |
return r;
|
|
|
84b277 |
|
|
|
84b277 |
STRV_FOREACH(i, files) {
|
|
|
84b277 |
+ UnitFileState state;
|
|
|
84b277 |
+
|
|
|
84b277 |
+ state = unit_file_get_state(scope, root_dir, *i);
|
|
|
84b277 |
+ if (state < 0) {
|
|
|
84b277 |
+ log_error("Failed to get unit file state for %s: %s", *i, strerror(-state));
|
|
|
84b277 |
+ return state;
|
|
|
84b277 |
+ }
|
|
|
84b277 |
+
|
|
|
84b277 |
+ if (state == UNIT_FILE_MASKED || state == UNIT_FILE_MASKED_RUNTIME) {
|
|
|
84b277 |
+ log_error("Failed to enable unit: Unit %s is masked", *i);
|
|
|
84b277 |
+ return -ENOTSUP;
|
|
|
84b277 |
+ }
|
|
|
84b277 |
+
|
|
|
84b277 |
r = install_info_add_auto(&c, *i);
|
|
|
84b277 |
if (r < 0)
|
|
|
84b277 |
return r;
|