[network-manager-pptp/th/logging-bgo771664: 2/11] service: add missing error handling when parsing command line



commit 42d2619dd0363c30892d51d908d21f2e80060d94
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-pptp-service.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/nm-pptp-service.c b/src/nm-pptp-service.c
index 738ab6a..ed89368 100644
--- a/src/nm-pptp-service.c
+++ b/src/nm-pptp-service.c
@@ -1088,9 +1088,7 @@ main (int argc, char *argv[])
                {NULL}
        };
 
-#if !GLIB_CHECK_VERSION (2, 35, 0)
-       g_type_init ();
-#endif
+       nm_g_type_init ();
 
        /* locale will be set according to environment LC_* variables */
        setlocale (LC_ALL, "");
@@ -1109,7 +1107,12 @@ main (int argc, char *argv[])
        g_option_context_set_summary (opt_ctx,
            _("nm-pptp-service provides integrated PPTP VPN capability (compatible with Microsoft and other 
implementations) to NetworkManager."));
 
-       g_option_context_parse (opt_ctx, &argc, &argv, NULL);
+       if (!g_option_context_parse (opt_ctx, &argc, &argv, NULL)) {
+               g_printerr ("Error parsing the command line options: %s\n", 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]