diff options
| author | William Jon McCann <mccann@jhu.edu> | 2007-10-22 21:00:16 -0400 | 
|---|---|---|
| committer | William Jon McCann <mccann@jhu.edu> | 2007-10-22 21:00:16 -0400 | 
| commit | 7b65ac249a1e28c9af25eb91919d898c3e0f8162 (patch) | |
| tree | bed889d57cef86a18c293e840751a7579e774ceb /src | |
| parent | 5db2f7fdc2d1c5a45bc33d916d82c23178568923 (diff) | |
error out if unknown options are passed on command line
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.c | 11 | 
1 files changed, 9 insertions, 2 deletions
@@ -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));  | 
