summaryrefslogtreecommitdiff
path: root/src/systemctl/systemctl.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/systemctl/systemctl.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/systemctl/systemctl.c')
-rw-r--r--src/systemctl/systemctl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 6394b4749e..4103a5da6d 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -5473,6 +5473,8 @@ static int enable_unit(int argc, char *argv[], void *userdata) {
if (r == -ESHUTDOWN)
return log_error_errno(r, "Unit file is masked.");
+ if (r == -EADDRNOTAVAIL)
+ return log_error_errno(r, "Unit file is generated.");
if (r < 0)
return log_error_errno(r, "Operation failed: %m");
@@ -5639,6 +5641,8 @@ static int add_dependency(int argc, char *argv[], void *userdata) {
r = unit_file_add_dependency(arg_scope, arg_runtime, arg_root, names, target, dep, arg_force, &changes, &n_changes);
if (r == -ESHUTDOWN)
return log_error_errno(r, "Unit file is masked.");
+ if (r == -EADDRNOTAVAIL)
+ return log_error_errno(r, "Unit file is generated.");
if (r < 0)
return log_error_errno(r, "Can't add dependency: %m");