mirror of
https://github.com/systemd/systemd.git
synced 2025-01-03 05:18:09 +03:00
systemctl: shutdown don't fallback on auth fail
For shutdowns don't fall back to starting the target directly if talking to logind failed with auth failure. That would just lead to another polkit auth attempt.
This commit is contained in:
parent
5ed73478e1
commit
38d55bf264
@ -156,8 +156,8 @@ int halt_main(void) {
|
||||
}
|
||||
if (r >= 0)
|
||||
return r;
|
||||
if (IN_SET(r, -EOPNOTSUPP, -EINPROGRESS))
|
||||
/* Requested operation is not supported on the local system or already in
|
||||
if (IN_SET(r, -EACCES, -EOPNOTSUPP, -EINPROGRESS))
|
||||
/* Requested operation requires auth, is not supported on the local system or already in
|
||||
* progress */
|
||||
return r;
|
||||
/* on all other errors, try low-level operation */
|
||||
|
@ -330,7 +330,7 @@ int logind_schedule_shutdown(void) {
|
||||
|
||||
r = bus_call_method(bus, bus_login_mgr, "ScheduleShutdown", &error, NULL, "st", action, arg_when);
|
||||
if (r < 0)
|
||||
return log_warning_errno(r, "Failed to call ScheduleShutdown in logind, proceeding with immediate shutdown: %s", bus_error_message(&error, r));
|
||||
return log_warning_errno(r, "Failed to schedule shutdown: %s", bus_error_message(&error, r));
|
||||
|
||||
if (!arg_quiet)
|
||||
logind_show_shutdown();
|
||||
|
@ -213,8 +213,8 @@ int start_special(int argc, char *argv[], void *userdata) {
|
||||
r = logind_reboot(a);
|
||||
if (r >= 0)
|
||||
return r;
|
||||
if (IN_SET(r, -EOPNOTSUPP, -EINPROGRESS))
|
||||
/* Requested operation is not supported or already in progress */
|
||||
if (IN_SET(r, -EACCES, -EOPNOTSUPP, -EINPROGRESS))
|
||||
/* Requested operation requires auth, is not supported or already in progress */
|
||||
return r;
|
||||
|
||||
/* On all other errors, try low-level operation. In order to minimize the difference
|
||||
|
Loading…
Reference in New Issue
Block a user