From 93e1e654675ea83ee4a13106abe71f2ee297b4b0 Mon Sep 17 00:00:00 2001 From: Francesco Giudici Date: Wed, 22 Jun 2016 12:09:37 +0200 Subject: [PATCH] nmcli: manage "--ask connection add" with no args When parsing arguments of "connection add" we first read the available property-value pairs and then check if the --ask option was passed in order to aid in the fill process of a new connection. Anyway, if there are no property-value tuples at all, we don't even check the --ask option, returning with error. Fix this just checking if any arg is there (argc) before invoking read_connection_properties(). --- clients/cli/connections.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clients/cli/connections.c b/clients/cli/connections.c index c9f0cfad6f..17021b1096 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -4639,8 +4639,8 @@ do_connection_add (NmCli *nmc, int argc, char **argv) nm_connection_add_setting (connection, NM_SETTING (s_con)); read_properties: - /* Get the argument from the command line. */ - if (!read_connection_properties (nmc, connection, &argc, &argv, &error)) { + /* Get the arguments from the command line if any */ + if (argc && !read_connection_properties (nmc, connection, &argc, &argv, &error)) { if (g_strcmp0 (*argv, "--") == 0 && !seen_dash_dash) { /* This is for compatibility with older nmcli that required * options and properties to be separated with "--" */