diff options
author | Michael Biebl <biebl@debian.org> | 2009-07-14 17:40:56 +0200 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2009-07-14 17:40:56 +0200 |
commit | 517ae9bab3e1aeda58ef4f042fa1346d411a9a4c (patch) | |
tree | 450b1355a1f8138ea9a031bd0653f2c1da9e18d7 /src/main.c | |
parent | b4c56fb4b5f0c496b544080c5dd38d3cf93c10e8 (diff) | |
download | consolekit-517ae9bab3e1aeda58ef4f042fa1346d411a9a4c.tar.gz |
Imported Upstream version 0.2.3upstream/0.2.3
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -38,6 +38,7 @@ #include <dbus/dbus-glib.h> #include <dbus/dbus-glib-lowlevel.h> +#include "ck-sysdeps.h" #include "ck-manager.h" #include "ck-log.h" @@ -49,8 +50,8 @@ static void bus_proxy_destroyed_cb (DBusGProxy *bus_proxy, static gboolean timed_exit_cb (GMainLoop *loop) { - g_main_loop_quit (loop); - return FALSE; + g_main_loop_quit (loop); + return FALSE; } static DBusGProxy * @@ -58,7 +59,7 @@ get_bus_proxy (DBusGConnection *connection) { DBusGProxy *bus_proxy; - bus_proxy = dbus_g_proxy_new_for_name (connection, + bus_proxy = dbus_g_proxy_new_for_name (connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); @@ -80,7 +81,7 @@ acquire_name_on_proxy (DBusGProxy *bus_proxy) } error = NULL; - res = dbus_g_proxy_call (bus_proxy, + res = dbus_g_proxy_call (bus_proxy, "RequestName", &error, G_TYPE_STRING, CK_DBUS_NAME, @@ -96,9 +97,9 @@ acquire_name_on_proxy (DBusGProxy *bus_proxy) g_warning ("Failed to acquire %s", CK_DBUS_NAME); } goto out; - } + } - if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { + if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { if (error != NULL) { g_warning ("Failed to acquire %s: %s", CK_DBUS_NAME, error->message); g_error_free (error); @@ -283,6 +284,11 @@ main (int argc, dbus_g_thread_init (); g_type_init (); + if (! ck_is_root_user ()) { + g_warning ("Must be run as root"); + exit (1); + } + context = g_option_context_new (_("Console kit daemon")); g_option_context_add_main_entries (context, entries, NULL); g_option_context_parse (context, &argc, &argv, NULL); |