mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
systemctl: print better message if default target is masked
If the default target is masked, `systemctl get-default` prints
Failed to get default target: Operation not possible due to RF-kill
That's a bit too cryptic, so let's make it clear what's actually
happening.
Fixes #26589.
(cherry picked from commit 7c78a19322
)
This commit is contained in:
parent
791754f683
commit
144ac494ec
@ -2200,6 +2200,8 @@ static int method_get_default_target(sd_bus_message *message, void *userdata, sd
|
|||||||
return r;
|
return r;
|
||||||
|
|
||||||
r = unit_file_get_default(m->unit_file_scope, NULL, &default_target);
|
r = unit_file_get_default(m->unit_file_scope, NULL, &default_target);
|
||||||
|
if (r == -ERFKILL)
|
||||||
|
sd_bus_error_setf(error, BUS_ERROR_UNIT_MASKED, "Unit file is masked.");
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
@ -50,6 +50,8 @@ static int determine_default(char **ret_name) {
|
|||||||
|
|
||||||
if (install_client_side()) {
|
if (install_client_side()) {
|
||||||
r = unit_file_get_default(arg_scope, arg_root, ret_name);
|
r = unit_file_get_default(arg_scope, arg_root, ret_name);
|
||||||
|
if (r == -ERFKILL)
|
||||||
|
return log_error_errno(r, "Failed to get default target: Unit file is masked.");
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to get default target: %m");
|
return log_error_errno(r, "Failed to get default target: %m");
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user