]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: use the retval of must_be_root()
authorMike Yuan <me@yhndnzj.com>
Sat, 17 Aug 2024 18:33:12 +0000 (20:33 +0200)
committerMike Yuan <me@yhndnzj.com>
Thu, 31 Oct 2024 14:32:32 +0000 (15:32 +0100)
src/systemctl/systemctl-compat-halt.c

index 4f6e30481678cfd4445f74e0221f6ef9422e6ce0..9d692300973831cafa2ac09b68595b605061beab 100644 (file)
@@ -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)