summaryrefslogtreecommitdiff
path: root/src/shared/install.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-02-24 16:02:48 +0100
committerLennart Poettering <lennart@poettering.net>2016-04-12 13:43:29 +0200
commit7bfe3d44d008f46d65ebdf5adc0c847b45fd4ab2 (patch)
treeeb9cc09f0cf1c6bddc4b33fe3272a4145d5c1012 /src/shared/install.c
parentf413930863ab3b98cb7bf9e761081b4e88a5d7d9 (diff)
core: when enabling a generated unit file, return a clean error
Let's be precise when the user tries to invoke an "enable" operation on a generated unit file.
Diffstat (limited to 'src/shared/install.c')
-rw-r--r--src/shared/install.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/shared/install.c b/src/shared/install.c
index 202d16e129..1e497d1492 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1761,6 +1761,8 @@ int unit_file_add_dependency(
return r;
if (target_info->type == UNIT_FILE_TYPE_MASKED)
return -ESHUTDOWN;
+ if (unit_file_is_generated(&paths, target_info->path))
+ return -EADDRNOTAVAIL;
assert(target_info->type == UNIT_FILE_TYPE_REGULAR);
@@ -1772,6 +1774,8 @@ int unit_file_add_dependency(
return r;
if (i->type == UNIT_FILE_TYPE_MASKED)
return -ESHUTDOWN;
+ if (unit_file_is_generated(&paths, i->path))
+ return -EADDRNOTAVAIL;
assert(i->type == UNIT_FILE_TYPE_REGULAR);
@@ -1830,6 +1834,8 @@ int unit_file_enable(
return r;
if (i->type == UNIT_FILE_TYPE_MASKED)
return -ESHUTDOWN;
+ if (unit_file_is_generated(&paths, i->path))
+ return -EADDRNOTAVAIL;
assert(i->type == UNIT_FILE_TYPE_REGULAR);
}
@@ -1957,6 +1963,8 @@ int unit_file_set_default(
return r;
if (i->type == UNIT_FILE_TYPE_MASKED)
return -ESHUTDOWN;
+ if (unit_file_is_generated(&paths, i->path))
+ return -EADDRNOTAVAIL;
path = strjoina(config_path, "/" SPECIAL_DEFAULT_TARGET);
@@ -2254,6 +2262,8 @@ static int preset_prepare_one(
if (i->type == UNIT_FILE_TYPE_MASKED)
return -ESHUTDOWN;
+ if (unit_file_is_generated(paths, i->path))
+ return -EADDRNOTAVAIL;
} else
r = install_info_discover(scope, minus, root_dir, paths, name, SEARCH_FOLLOW_CONFIG_SYMLINKS, &i);