mirror of
https://github.com/systemd/systemd.git
synced 2025-02-01 09:47:35 +03:00
systemctl: correctly proceed to immediate shutdown if scheduling fails
Actually check the return code from logind_schedule_shutdown() and proceed to immediate shutdown if that fails. Negative return codes can be returned if systemctl is compiled without logind support, or if logind otherwise failed (either too old, disabled/masked, or it is incomplete systemd-shim/systemd-service implementation).
This commit is contained in:
parent
cf9cda441a
commit
940bec70bb
@ -8576,8 +8576,10 @@ static int halt_main(void) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (arg_when > 0)
|
||||
return logind_schedule_shutdown();
|
||||
/* Delayed shutdown requested, and was successful */
|
||||
if (arg_when > 0 && logind_schedule_shutdown() == 0)
|
||||
return 0;
|
||||
/* no delay, or logind failed or is not at all available */
|
||||
|
||||
if (geteuid() != 0) {
|
||||
if (arg_dry_run || arg_force > 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user