X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Finstall.c;h=cab93e8dc6b3ab140a330cf3a1084b2860c980dd;hb=592fd144ae313855f48d0ca52a103013b41e5d59;hp=0d7c30e29d67415db34c177d1db2db83b2d92927;hpb=2d5c93c7af05bfa25cad85909acdb7b0bfc3f4e1;p=elogind.git diff --git a/src/shared/install.c b/src/shared/install.c index 0d7c30e29..cab93e8dc 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -1620,12 +1620,10 @@ int unit_file_enable( STRV_FOREACH(i, files) { UnitFileState state; + /* We only want to know if this unit is masked, so we ignore + * errors from unit_file_get_state, deferring other checks. + * This allows templated units to be enabled on the fly. */ 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; @@ -1679,7 +1677,7 @@ int unit_file_disable( r = install_context_mark_for_removal(&c, &paths, &remove_symlinks_to, config_path, root_dir); q = remove_marked_symlinks(remove_symlinks_to, config_path, changes, n_changes, files); - if (r == 0) + if (r >= 0) r = q; return r;