chiark / gitweb /
systemctl: short cut things if we aren't root and the user requested a reboot to...
[elogind.git] / src / systemctl.c
index a9a975ee8188648ceb775d5b3ce0e6e1bc801986..03143379030cf2d7e10213a6fc071dfe8d530262 100644 (file)
@@ -3156,7 +3156,12 @@ static int start_with_fallback(DBusConnection *bus) {
 static int halt_main(DBusConnection *bus) {
         int r;
 
-        if (!arg_immediate)
+        if (geteuid() != 0) {
+                log_error("Must to be root.");
+                return -EPERM;
+        }
+
+        if (!arg_dry && !arg_immediate)
                 return start_with_fallback(bus);
 
         if (!arg_no_wtmp)