[network-manager-vpnc/th/vpn-editor-split-bgo766170] service: add missing error handling when parsing command line
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-vpnc/th/vpn-editor-split-bgo766170] service: add missing error handling when parsing command line
- Date: Mon, 16 May 2016 10:29:36 +0000 (UTC)
commit 541c00e79a8e0bad6a414c252a13dcd1a10808de
Author: Thomas Haller <thaller redhat com>
Date: Mon May 16 12:28:16 2016 +0200
service: add missing error handling when parsing command line
src/nm-vpnc-service.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/nm-vpnc-service.c b/src/nm-vpnc-service.c
index 331762d..8b994a9 100644
--- a/src/nm-vpnc-service.c
+++ b/src/nm-vpnc-service.c
@@ -1172,6 +1172,7 @@ main (int argc, char *argv[])
GOptionContext *opt_ctx = NULL;
gs_free char *bus_name_free = NULL;
const char *bus_name;
+ GError *error = NULL;
GOptionEntry options[] = {
{ "persist", 0, 0, G_OPTION_ARG_NONE, &persist, N_("Don't quit when VPN connection
terminates"), NULL },
@@ -1202,7 +1203,13 @@ main (int argc, char *argv[])
_("nm-vpnc-service provides integrated "
"Cisco Legacy IPsec VPN 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 (EXIT_FAILURE);
+ }
+
g_option_context_free (opt_ctx);
bus_name = bus_name_free ?: NM_DBUS_SERVICE_VPNC;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]