summaryrefslogtreecommitdiff
path: root/src/shared/install.c
diff options
context:
space:
mode:
authorJan Synacek <jsynacek@redhat.com>2014-10-07 13:35:41 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-10-07 17:08:18 -0400
commitf7101b7368dfe41dbc8b7203e06133cccb589c01 (patch)
treeb44d9977a9d11f60e0aea4fa766f6ab794e5ecb3 /src/shared/install.c
parente91c8c201931d6be8229d624c10ed9c7c210d470 (diff)
core: don't allow enabling if unit is masked
Diffstat (limited to 'src/shared/install.c')
-rw-r--r--src/shared/install.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/shared/install.c b/src/shared/install.c
index fa064c230f..945bb2748d 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1516,6 +1516,19 @@ int unit_file_enable(
return r;
STRV_FOREACH(i, files) {
+ UnitFileState state;
+
+ state = unit_file_get_state(scope, root_dir, *i);
+ if (state < 0) {
+ log_error("Failed to get unit file state for %s: %s", *i, strerror(-state));
+ return state;
+ }
+
+ if (state == UNIT_FILE_MASKED || state == UNIT_FILE_MASKED_RUNTIME) {
+ log_error("Failed to enable unit: Unit %s is masked", *i);
+ return -ENOTSUP;
+ }
+
r = install_info_add_auto(&c, *i);
if (r < 0)
return r;