summaryrefslogtreecommitdiff
path: root/clients
diff options
context:
space:
mode:
authorJiří Klimeš <jklimes@redhat.com>2014-11-28 14:11:05 +0100
committerJiří Klimeš <jklimes@redhat.com>2014-11-28 14:27:31 +0100
commit72156ba1c514c295992154d774f12eb73fb9d971 (patch)
treeac7d6f424a0f12851f34507611b617dc4cd02f39 /clients
parent313a4081b53c621e1f915491c1c86a58c5b096c1 (diff)
downloadNetworkManager-72156ba1c514c295992154d774f12eb73fb9d971.tar.gz
cli: fix setting ethernet.s390-subchannels
It was not properly updated in a7c4d53d036c0f75b0903c95de7cb8fbdc47413f (when updating stuff to ne libnm). And allow 2 subchannels (libnm and ifcfg-rh allow it too).
Diffstat (limited to 'clients')
-rw-r--r--clients/cli/settings.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/clients/cli/settings.c b/clients/cli/settings.c
index 3776ace63f..4153e40428 100644
--- a/clients/cli/settings.c
+++ b/clients/cli/settings.c
@@ -4004,32 +4004,27 @@ DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_wired_remove_mac_address_blacklist,
static gboolean
nmc_property_wired_set_s390_subchannels (NMSetting *setting, const char *prop, const char *val, GError **error)
{
- char **strv = NULL, **iter;
- GPtrArray *s390_subchannels;
+ char **strv = NULL;
+ int len;
- //FIXME: both libnm and ifcfg-rh also allow two strings (3rd is optional)
strv = nmc_strsplit_set (val, " ,\t", 0);
- if (g_strv_length (strv) != 3) {
- g_set_error (error, 1, 0, _("'%s' is not valid; 3 strings should be provided"),
+ len = g_strv_length (strv);
+ if (len != 2 && len != 3) {
+ g_set_error (error, 1, 0, _("'%s' is not valid; 2 or 3 strings should be provided"),
val);
g_strfreev (strv);
return FALSE;
}
- s390_subchannels = g_ptr_array_sized_new (3);
- for (iter = strv; iter && *iter; iter++)
- g_ptr_array_add (s390_subchannels, *iter);
-
- g_object_set (setting, prop, s390_subchannels, NULL);
+ g_object_set (setting, prop, strv, NULL);
g_strfreev (strv);
- g_ptr_array_free (s390_subchannels, TRUE);
return TRUE;
}
static const char *
nmc_property_wired_describe_s390_subchannels (NMSetting *setting, const char *prop)
{
- return _("Enter a list of three channels (comma or space separated).\n\n"
+ return _("Enter a list of subchannels (comma or space separated).\n\n"
"Example: 0.0.0e20 0.0.0e21 0.0.0e22\n");
}