[network-manager-openvpn/lr/multiple-vpn: 5/8] service: add missing error handling



commit 0ce1e7e0c979e4984ce9ca2bbf130734a1657328
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Fri Aug 21 17:14:03 2015 +0200

    service: add missing error handling

 src/nm-openvpn-service.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/nm-openvpn-service.c b/src/nm-openvpn-service.c
index ba2adc6..4941b21 100644
--- a/src/nm-openvpn-service.c
+++ b/src/nm-openvpn-service.c
@@ -1826,6 +1826,7 @@ main (int argc, char *argv[])
        gboolean persist = FALSE;
        GOptionContext *opt_ctx = NULL;
        gchar *bus_name = NM_DBUS_SERVICE_OPENVPN;
+       GError *error = NULL;
 
        GOptionEntry options[] = {
                { "persist", 0, 0, G_OPTION_ARG_NONE, &persist, N_("Don't quit when VPN connection 
terminates"), NULL },
@@ -1856,7 +1857,12 @@ main (int argc, char *argv[])
                                      _("nm-openvpn-service provides integrated "
                                        "OpenVPN capability 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_clear_error (&error);
+               exit (1);
+       }
        g_option_context_free (opt_ctx);
 
        if (getenv ("OPENVPN_DEBUG"))


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