From: Mike Yuan Date: Sat, 17 Aug 2024 18:33:12 +0000 (+0200) Subject: systemctl: use the retval of must_be_root() X-Git-Tag: v257-rc1~73^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5aa48b6de1119a204ddb19ae23b069036a3ca78d;p=thirdparty%2Fsystemd.git systemctl: use the retval of must_be_root() --- 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)