[network-manager-fortisslvpn/th/gtk-split-and-log-bgo771544: 18/26] service: add missing error handling when parsing command line



commit 55a680e8b388ebed1d2703100237fe03a4ef56bb
Author: Thomas Haller <thaller redhat com>
Date:   Fri Sep 16 15:52:02 2016 +0200

    service: add missing error handling when parsing command line

 src/nm-fortisslvpn-service.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/nm-fortisslvpn-service.c b/src/nm-fortisslvpn-service.c
index 4fafb45..5d036a4 100644
--- a/src/nm-fortisslvpn-service.c
+++ b/src/nm-fortisslvpn-service.c
@@ -745,6 +745,7 @@ main (int argc, char *argv[])
        gboolean persist = FALSE;
        GOptionContext *opt_ctx = NULL;
        gchar *bus_name = NM_DBUS_SERVICE_FORTISSLVPN;
+       GError *error = NULL;
 
        GOptionEntry options[] = {
                { "persist", 0, 0, G_OPTION_ARG_NONE, &persist, N_("Don't quit when VPN connection 
terminates"), NULL },
@@ -772,7 +773,12 @@ main (int argc, char *argv[])
        g_option_context_set_summary (opt_ctx,
            _("nm-fortisslvpn-service provides integrated SSLVPN capability (compatible with Fortinet) to 
NetworkManager."));
 
-       g_option_context_parse (opt_ctx, &argc, &argv, NULL);
+       if (!g_option_context_parse (opt_ctx, &argc, &argv, &error)) {
+               g_warning ("Error parsing the command line options: %s", error->message);
+               g_option_context_free (opt_ctx);
+               g_error_free (error);
+               return EXIT_FAILURE;
+       }
        g_option_context_free (opt_ctx);
 
        if (getenv ("NM_PPP_DEBUG"))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]