summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2014-06-06 23:18:47 +0200
committerThomas Haller <thaller@redhat.com>2014-06-06 23:19:49 +0200
commitbcb9f6c9109bc8cb60e67ab985bebd5fd460febb (patch)
treecdbc1cda7bf3e17127a2d7dda90e6e2b12e890f8 /cli
parent5fa1248a2f06ebaa5ee80c6a5917491d3523f6fc (diff)
downloadNetworkManager-bcb9f6c9109bc8cb60e67ab985bebd5fd460febb.tar.gz
cli: fix error parsing input arguments in non-interactive mode
Causes the following failure: $ /bin/nmcli connection add type ethernet con-name connie ifname '*' (process:13883): GLib-CRITICAL **: g_strchug: assertion `string != NULL' failed (process:13883): GLib-CRITICAL **: g_strchomp: assertion `string != NULL' failed Error: invalid connection type; '' not among [generic, ...]. Regression introduced by commit bfb1200b4f279f83c113d048839044ad51ca2af7. Signed-off-by: Thomas Haller <thaller@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/connections.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/cli/src/connections.c b/cli/src/connections.c
index 679ef2bbb3..c2af659b6e 100644
--- a/cli/src/connections.c
+++ b/cli/src/connections.c
@@ -4798,7 +4798,8 @@ cleanup_bridge_slave:
_("Error: 'vpn-type' is required."));
goto cleanup_vpn;
}
- vpn_type = g_strstrip (vpn_type_ask);
+ if (vpn_type_ask)
+ vpn_type = g_strstrip (vpn_type_ask);
if (!(st = nmc_string_is_valid (vpn_type, nmc_known_vpns, NULL))) {
printf (_("Warning: 'vpn-type': %s not known.\n"), vpn_type);
@@ -5218,7 +5219,8 @@ do_connection_add (NmCli *nmc, int argc, char **argv)
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
goto error;
}
- type = g_strstrip (type_ask);
+ if (type_ask)
+ type = g_strstrip (type_ask);
if (!(setting_name = check_valid_name (type, nmc_valid_connection_types, &error))) {
g_string_printf (nmc->return_text, _("Error: invalid connection type; %s."),