diff options
author | Mike Yuan <me@yhndnzj.com> | 2024-08-17 20:33:12 +0200 |
---|---|---|
committer | Mike Yuan <me@yhndnzj.com> | 2024-10-31 15:32:32 +0100 |
commit | 5aa48b6de1119a204ddb19ae23b069036a3ca78d (patch) | |
tree | 26c00ebcf65339eb374ecc1233b2a18d67584c74 /src/systemctl | |
parent | mkosi: Install gdb in centos/fedora build image (diff) | |
download | systemd-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.c | 7 |
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) |