summaryrefslogtreecommitdiff
path: root/src/systemctl
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-11-12 18:18:45 +0100
committerDaniel Mack <github@zonque.org>2015-11-12 18:18:45 +0100
commitf1637bd3a81fe0468b53d7aa91b44cc0c34410d7 (patch)
tree60306026034427f5016a1da67cdb9d4689e2a5e9 /src/systemctl
parent05c450966a08ff85fa8348e2fe41b722612fa3dc (diff)
parent79413b673b45adc98dfeaec882bbdda2343cb2f9 (diff)
Merge pull request #1515 from poettering/install-symlink
install: follow unit file symlinks in /usr, but not /etc when looking for [Install] data and more
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index e9d73ea9d0..be98bc9671 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -1335,7 +1335,7 @@ static void output_unit_file_list(const UnitFileList *units, unsigned c) {
UNIT_FILE_MASKED,
UNIT_FILE_MASKED_RUNTIME,
UNIT_FILE_DISABLED,
- UNIT_FILE_INVALID)) {
+ UNIT_FILE_BAD)) {
on = ansi_highlight_red();
off = ansi_normal();
} else if (u->state == UNIT_FILE_ENABLED) {
@@ -5437,10 +5437,10 @@ static int enable_unit(int argc, char *argv[], void *userdata) {
else
assert_not_reached("Unknown verb");
- if (r < 0) {
- log_error_errno(r, "Operation failed: %m");
- goto finish;
- }
+ if (r == -ESHUTDOWN)
+ return log_error_errno(r, "Unit file is masked.");
+ if (r < 0)
+ return log_error_errno(r, "Operation failed: %m");
if (!arg_quiet)
dump_unit_file_changes(changes, n_changes);
@@ -5557,7 +5557,7 @@ static int enable_unit(int argc, char *argv[], void *userdata) {
r = acquire_bus(BUS_MANAGER, &bus);
if (r < 0)
- return r;
+ goto finish;
new_args[0] = (char*) (streq(argv[0], "enable") ? "start" : "stop");
for (i = 0; i < n_changes; i++)
@@ -5603,7 +5603,8 @@ static int add_dependency(int argc, char *argv[], void *userdata) {
unsigned n_changes = 0;
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 < 0)
return log_error_errno(r, "Can't add dependency: %m");
@@ -5740,8 +5741,8 @@ static int unit_is_enabled(int argc, char *argv[], void *userdata) {
STRV_FOREACH(name, names) {
UnitFileState state;
- state = unit_file_get_state(arg_scope, arg_root, *name);
- if (state < 0)
+ r = unit_file_get_state(arg_scope, arg_root, *name, &state);
+ if (r < 0)
return log_error_errno(state, "Failed to get unit file state for %s: %m", *name);
if (IN_SET(state,