|
|
b11b5f |
From 1d63577410cde215c04921d62f435259a6b258d7 Mon Sep 17 00:00:00 2001
|
|
|
b11b5f |
From: Ludwig Nussel <ludwig.nussel@suse.de>
|
|
|
b11b5f |
Date: Mon, 20 Dec 2021 18:05:50 +0100
|
|
|
b11b5f |
Subject: [PATCH] systemctl: shutdown don't fallback on auth fail
|
|
|
b11b5f |
|
|
|
b11b5f |
For shutdowns don't fall back to starting the target directly if talking
|
|
|
b11b5f |
to logind failed with auth failure. That would just lead to another
|
|
|
b11b5f |
polkit auth attempt.
|
|
|
b11b5f |
|
|
|
b11b5f |
(cherry picked from commit 38d55bf2641f345445cb4e6a5e5e808555591db2)
|
|
|
b11b5f |
|
|
|
b11b5f |
Related: #2053273
|
|
|
b11b5f |
---
|
|
|
b11b5f |
src/systemctl/systemctl.c | 10 +++++-----
|
|
|
b11b5f |
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
|
b11b5f |
|
|
|
b11b5f |
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
|
|
|
b11b5f |
index 4bedb52f2a..199f736f7f 100644
|
|
|
b11b5f |
--- a/src/systemctl/systemctl.c
|
|
|
b11b5f |
+++ b/src/systemctl/systemctl.c
|
|
|
b11b5f |
@@ -3675,8 +3675,8 @@ static int start_special(int argc, char *argv[], void *userdata) {
|
|
|
b11b5f |
r = logind_reboot(a);
|
|
|
b11b5f |
if (r >= 0)
|
|
|
b11b5f |
return r;
|
|
|
b11b5f |
- if (IN_SET(r, -EOPNOTSUPP, -EINPROGRESS))
|
|
|
b11b5f |
- /* requested operation is not supported or already in progress */
|
|
|
b11b5f |
+ if (IN_SET(r, -EACCES, -EOPNOTSUPP, -EINPROGRESS))
|
|
|
b11b5f |
+ /* Requested operation requires auth, is not supported or already in progress */
|
|
|
b11b5f |
return r;
|
|
|
b11b5f |
|
|
|
b11b5f |
/* On all other errors, try low-level operation. In order to minimize the difference between
|
|
|
b11b5f |
@@ -8644,7 +8644,7 @@ static int logind_schedule_shutdown(void) {
|
|
|
b11b5f |
action,
|
|
|
b11b5f |
arg_when);
|
|
|
b11b5f |
if (r < 0)
|
|
|
b11b5f |
- return log_warning_errno(r, "Failed to call ScheduleShutdown in logind, proceeding with immediate shutdown: %s", bus_error_message(&error, r));
|
|
|
b11b5f |
+ return log_warning_errno(r, "Failed to schedule shutdown: %s", bus_error_message(&error, r));
|
|
|
b11b5f |
|
|
|
b11b5f |
if (!arg_quiet)
|
|
|
b11b5f |
log_info("Shutdown scheduled for %s, use 'shutdown -c' to cancel.", format_timestamp(date, sizeof(date), arg_when));
|
|
|
b11b5f |
@@ -8670,8 +8670,8 @@ static int halt_main(void) {
|
|
|
b11b5f |
}
|
|
|
b11b5f |
if (r >= 0)
|
|
|
b11b5f |
return r;
|
|
|
b11b5f |
- if (IN_SET(r, -EOPNOTSUPP, -EINPROGRESS))
|
|
|
b11b5f |
- /* Requested operation is not supported on the local system or already in
|
|
|
b11b5f |
+ if (IN_SET(r, -EACCES, -EOPNOTSUPP, -EINPROGRESS))
|
|
|
b11b5f |
+ /* Requested operation requires auth, is not supported on the local system or already in
|
|
|
b11b5f |
* progress */
|
|
|
b11b5f |
return r;
|
|
|
b11b5f |
/* on all other errors, try low-level operation */
|