From 5aa48b6de1119a204ddb19ae23b069036a3ca78d Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Sat, 17 Aug 2024 20:33:12 +0200 Subject: [PATCH] systemctl: use the retval of must_be_root() --- src/systemctl/systemctl-compat-halt.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/systemctl/systemctl-compat-halt.c b/src/systemctl/systemctl-compat-halt.c index 4f6e3048167..9d692300973 100644 --- a/src/systemctl/systemctl-compat-halt.c +++ b/src/systemctl/systemctl-compat-halt.c @@ -180,10 +180,9 @@ int halt_main(void) { return start_with_fallback(); } - if (geteuid() != 0) { - (void) must_be_root(); - return -EPERM; - } + r = must_be_root(); + if (r < 0) + return r; if (!arg_no_wtmp) { if (sd_booted() > 0) -- 2.47.3