summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Jon McCann <mccann@jhu.edu>2007-10-22 21:00:16 -0400
committerWilliam Jon McCann <mccann@jhu.edu>2007-10-22 21:00:16 -0400
commit7b65ac249a1e28c9af25eb91919d898c3e0f8162 (patch)
treebed889d57cef86a18c293e840751a7579e774ceb
parent5db2f7fdc2d1c5a45bc33d916d82c23178568923 (diff)
error out if unknown options are passed on command line
-rw-r--r--src/main.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 11b6f2e..e27b200 100644
--- a/src/main.c
+++ b/src/main.c
@@ -261,11 +261,12 @@ main (int argc,
GOptionContext *context;
DBusGProxy *bus_proxy;
DBusGConnection *connection;
+ GError *error;
int ret;
int pf;
ssize_t written;
char pid[9];
-
+ gboolean res;
static gboolean debug = FALSE;
static gboolean no_daemon = FALSE;
static gboolean do_timed_exit = FALSE;
@@ -291,8 +292,14 @@ main (int argc,
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);
+ error = NULL;
+ res = g_option_context_parse (context, &argc, &argv, &error);
g_option_context_free (context);
+ if (! res) {
+ g_warning (error->message);
+ g_error_free (error);
+ goto out;
+ }
if (! no_daemon && daemon (0, 0)) {
g_error ("Could not daemonize: %s", g_strerror (errno));