captive_init(): +Missing GObject initialization (for client/* interface)
authorshort <>
Sat, 22 Mar 2003 19:58:46 +0000 (19:58 +0000)
committershort <>
Sat, 22 Mar 2003 19:58:46 +0000 (19:58 +0000)
captive_init(): +check for excessive non-option arguments

src/libcaptive/client/init.c

index e1e2044..14903ac 100644 (file)
@@ -44,6 +44,7 @@
 #include <glib/glist.h>
 #include <glib/gutils.h>       /* for g_atexit() */
 #include "giochannel-blind.h"
+#include <glib-object.h>
 
 
 /* Are we initialized? */
@@ -336,6 +337,9 @@ int errint;
 
        g_return_val_if_fail(active==FALSE,FALSE);
 
+       /* Initialize GObject subsystem of GLib. */
+       g_type_init();
+
        /* (optionally) parse the given 'captive_args' string */
        if (captive_args) {
 int captive_args_argc;
@@ -368,7 +372,10 @@ gboolean r=FALSE;
                        g_assert_not_reached(); /* some non-callbacked argument reached */
                        goto args_err_context;
                        }
-               /* FIXME: reject non-"--"-prefixed arguments; how to detected them? */
+               if (poptPeekArg(context)) {
+                       g_assert_not_reached(); /* some non-"--"-prefixed argument reached */
+                       goto args_err_context;
+                       }
                r=TRUE; /* success */
 args_err_context:
                poptFreeContext(context);