chiark / gitweb /
systemctl: short cut things if we aren't root and the user requested a reboot to...
authorLennart Poettering <lennart@poettering.net>
Thu, 8 Jul 2010 19:31:23 +0000 (21:31 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 8 Jul 2010 19:36:40 +0000 (21:36 +0200)
src/systemctl.c

index 01deafe2a13b1d0edc3bcfe8633343ccc1eab471..03143379030cf2d7e10213a6fc071dfe8d530262 100644 (file)
@@ -3156,6 +3156,11 @@ static int start_with_fallback(DBusConnection *bus) {
 static int halt_main(DBusConnection *bus) {
         int r;
 
 static int halt_main(DBusConnection *bus) {
         int r;
 
+        if (geteuid() != 0) {
+                log_error("Must to be root.");
+                return -EPERM;
+        }
+
         if (!arg_dry && !arg_immediate)
                 return start_with_fallback(bus);
 
         if (!arg_dry && !arg_immediate)
                 return start_with_fallback(bus);