core: make sure we generate a nicer error when a linked unit is attempted to be enabled

We don't allow using config symlinks to enable units, but the error message we
printed was awful. Fix that, and generate a more readable error.

Fixes #3010.
This commit is contained in:
Lennart Poettering
2016-04-12 13:43:33 +02:00
parent d94c2b06f9
commit 8e20adcaa0
4 changed files with 24 additions and 15 deletions
+2
View File
@@ -5446,6 +5446,8 @@ static int enable_unit(int argc, char *argv[], void *userdata) {
return log_error_errno(r, "Unit file is masked.");
if (r == -EADDRNOTAVAIL)
return log_error_errno(r, "Unit file is transient or generated.");
if (r == -ELOOP)
return log_error_errno(r, "Refusing to operate on linked unit file.");
if (r < 0)
return log_error_errno(r, "Operation failed: %m");