summaryrefslogtreecommitdiffstats
path: root/src/systemctl
diff options
context:
space:
mode:
authorMike Yuan <me@yhndnzj.com>2024-08-17 20:33:12 +0200
committerMike Yuan <me@yhndnzj.com>2024-10-31 15:32:32 +0100
commit5aa48b6de1119a204ddb19ae23b069036a3ca78d (patch)
tree26c00ebcf65339eb374ecc1233b2a18d67584c74 /src/systemctl
parentmkosi: Install gdb in centos/fedora build image (diff)
downloadsystemd-5aa48b6de1119a204ddb19ae23b069036a3ca78d.tar.xz
systemd-5aa48b6de1119a204ddb19ae23b069036a3ca78d.zip
systemctl: use the retval of must_be_root()
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl-compat-halt.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/systemctl/systemctl-compat-halt.c b/src/systemctl/systemctl-compat-halt.c
index 4f6e304816..9d69230097 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)