1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-27 18:04:05 +03:00

systemctl: fix halt -f

Commit adefc8789b always asks logind for shutdown first. So I broke halt
-f which is supposed to issue a direct syscall in that case.
This commit is contained in:
Ludwig Nussel 2022-02-09 10:39:16 +01:00
parent 54141d8ddd
commit 2a3a5288cb

View File

@ -12,6 +12,7 @@
#include "systemctl-compat-halt.h"
#include "systemctl-compat-telinit.h"
#include "systemctl-logind.h"
#include "systemctl-start-unit.h"
#include "systemctl-util.h"
#include "systemctl.h"
#include "terminal-util.h"
@ -144,6 +145,7 @@ int halt_parse_argv(int argc, char *argv[]) {
int halt_main(void) {
int r;
if (arg_force == 0) {
/* always try logind first */
if (arg_when > 0)
r = logind_schedule_shutdown();
@ -166,8 +168,9 @@ int halt_main(void) {
* enable non-blocking mode for this, as logind's shutdown operations are always non-blocking. */
arg_no_block = true;
if (!arg_dry_run && !arg_force)
if (!arg_dry_run)
return start_with_fallback();
}
if (geteuid() != 0) {
(void) must_be_root();