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().
This commit is contained in:
Francesco Giudici 2016-06-22 12:09:37 +02:00
parent 0172c1ed2d
commit 93e1e65467

View file

@ -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 "--" */