mirror of
https://github.com/systemd/systemd.git
synced 2025-01-11 09:18:07 +03:00
systemctl: allow to change the default target without the --force switch
Currently "systemctl set-default" will fail to change the default target
due to the 'default.target' being a symlink which is always the case.
To work around this, the user must specify the "--force" switch to be
able to overwrite the existing symlink.
This is clearly a regression that was introduced by commit 718db96199
since it worked before without the "--force" switch and the man pages do
not mention that you need to specify it. It is expected that this is a
symlink.
So just explicity set the force flag to make it work again.
https://bugs.freedesktop.org/show_bug.cgi?id=76623
Reported-by: <code@progandy.de>
This commit is contained in:
parent
9754d56e9b
commit
a1484a216e
Notes:
Zbigniew Jędrzejewski-Szmek
2014-06-18 13:30:42 -04:00
Backport: fix
@ -1968,7 +1968,7 @@ static int set_default(sd_bus *bus, char **args) {
|
|||||||
return log_oom();
|
return log_oom();
|
||||||
|
|
||||||
if (!bus || avoid_bus()) {
|
if (!bus || avoid_bus()) {
|
||||||
r = unit_file_set_default(arg_scope, arg_root, unit, arg_force, &changes, &n_changes);
|
r = unit_file_set_default(arg_scope, arg_root, unit, true, &changes, &n_changes);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_error("Failed to set default target: %s", strerror(-r));
|
log_error("Failed to set default target: %s", strerror(-r));
|
||||||
return r;
|
return r;
|
||||||
@ -1990,7 +1990,7 @@ static int set_default(sd_bus *bus, char **args) {
|
|||||||
"SetDefaultTarget",
|
"SetDefaultTarget",
|
||||||
&error,
|
&error,
|
||||||
&reply,
|
&reply,
|
||||||
"sb", unit, arg_force);
|
"sb", unit, true);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_error("Failed to set default target: %s", bus_error_message(&error, -r));
|
log_error("Failed to set default target: %s", bus_error_message(&error, -r));
|
||||||
return r;
|
return r;
|
||||||
|
Loading…
Reference in New Issue
Block a user