diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-10-28 09:23:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-28 09:23:08 +0100 |
commit | e9cfc71222c8e6dac02c85f9c05ba1aba09a3b1c (patch) | |
tree | 0b05f1c5f1839bfeee30542e5225393cb493e530 | |
parent | 880a116ce3081b64d4eb80207551d1ab39b55788 (diff) | |
parent | 22683674716fd0e5b016ce5a7d8fd90df5f9f9e7 (diff) | |
download | systemd-e9cfc71222c8e6dac02c85f9c05ba1aba09a3b1c.tar.gz |
Merge pull request #13635 from fbuihuu/no-aliases-with-enable
man: alias names can't be used with enable command
-rw-r--r-- | man/systemd.unit.xml | 8 | ||||
-rw-r--r-- | src/core/dbus-manager.c | 6 | ||||
-rw-r--r-- | src/shared/install.c | 2 |
3 files changed, 9 insertions, 7 deletions
diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml index f6e9d2a17c..b3025ea09b 100644 --- a/man/systemd.unit.xml +++ b/man/systemd.unit.xml @@ -137,10 +137,10 @@ a symlink, so when <command>systemd</command> is asked through D-Bus to load <filename>dbus-org.freedesktop.network1.service</filename>, it'll load <filename>systemd-networkd.service</filename>. Alias names may be used in commands like - <command>enable</command>, <command>disable</command>, <command>start</command>, <command>stop</command>, - <command>status</command>, and similar, and in all unit dependency directives, including - <varname>Wants=</varname>, <varname>Requires=</varname>, <varname>Before=</varname>, - <varname>After=</varname>. Aliases cannot be used with the <command>preset</command> command.</para> + <command>disable</command>, <command>start</command>, <command>stop</command>, <command>status</command>, + and similar, and in all unit dependency directives, including <varname>Wants=</varname>, + <varname>Requires=</varname>, <varname>Before=</varname>, <varname>After=</varname>. Aliases cannot be + used with the <command>preset</command> command.</para> <para>Unit files may specify aliases through the <varname>Alias=</varname> directive in the [Install] section. When the unit is enabled, symlinks will be created for those names, and removed when the unit is diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index d98ec32a0b..76d8a03702 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -1903,11 +1903,13 @@ static int install_error( case -ELOOP: r = sd_bus_error_setf(error, BUS_ERROR_UNIT_LINKED, - "Refusing to operate on linked unit file %s", changes[i].path); + "Refusing to operate on alias name or linked unit file: %s", + changes[i].path); goto found; case -ENOENT: - r = sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT, "Unit file %s does not exist.", changes[i].path); + r = sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT, + "Unit file %s does not exist.", changes[i].path); goto found; default: diff --git a/src/shared/install.c b/src/shared/install.c index 8f9cf4a2f4..0724dd96ee 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -1897,7 +1897,7 @@ static int install_context_apply( q = install_info_traverse(scope, c, paths, i, flags, NULL); if (q < 0) { - unit_file_changes_add(changes, n_changes, r, i->name, NULL); + unit_file_changes_add(changes, n_changes, q, i->name, NULL); return q; } |