summaryrefslogtreecommitdiff
path: root/libnm-util/nm-setting-bond.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2013-10-09 11:26:55 +0200
committerThomas Haller <thaller@redhat.com>2013-10-25 22:32:47 +0200
commit0c6a98df786f015ae98d9c75af63906d25ff03ef (patch)
tree51bfb6901b40c40a7a7f32643c968966dad14a5a /libnm-util/nm-setting-bond.c
parentdf4e1597282100a6716f15d1c94caba4d162e7b1 (diff)
downloadNetworkManager-0c6a98df786f015ae98d9c75af63906d25ff03ef.tar.gz
libnm-util: do not g_warn when trying to set invalid bond option
nm_setting_bond_add_option returns TRUE or FALSE indicating, whether the bond option was properly set. So, the API already kind of expects invalid values, so there is no reason to warn about it. Co-Authored-By: Jiří Klimeš <jklimes@redhat.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
Diffstat (limited to 'libnm-util/nm-setting-bond.c')
-rw-r--r--libnm-util/nm-setting-bond.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/libnm-util/nm-setting-bond.c b/libnm-util/nm-setting-bond.c
index 66eab2cbda..88b1851d4c 100644
--- a/libnm-util/nm-setting-bond.c
+++ b/libnm-util/nm-setting-bond.c
@@ -330,7 +330,9 @@ nm_setting_bond_get_option_by_name (NMSettingBond *setting,
const char *name)
{
g_return_val_if_fail (NM_IS_SETTING_BOND (setting), NULL);
- g_return_val_if_fail (nm_setting_bond_validate_option (name, NULL), NULL);
+
+ if (!nm_setting_bond_validate_option (name, NULL))
+ return NULL;
return g_hash_table_lookup (NM_SETTING_BOND_GET_PRIVATE (setting)->options, name);
}
@@ -346,18 +348,23 @@ nm_setting_bond_get_option_by_name (NMSettingBond *setting,
* (ie [a-zA-Z0-9]). Adding a new name replaces any existing name/value pair
* that may already exist.
*
+ * The order of how to set several options is relevant because there are options
+ * that conflict with each other.
+ *
* Returns: %TRUE if the option was valid and was added to the internal option
* list, %FALSE if it was not.
**/
-gboolean nm_setting_bond_add_option (NMSettingBond *setting,
- const char *name,
- const char *value)
+gboolean
+nm_setting_bond_add_option (NMSettingBond *setting,
+ const char *name,
+ const char *value)
{
NMSettingBondPrivate *priv;
g_return_val_if_fail (NM_IS_SETTING_BOND (setting), FALSE);
- g_return_val_if_fail (nm_setting_bond_validate_option (name, value), FALSE);
- g_return_val_if_fail (value != NULL, FALSE);
+
+ if (!value || !nm_setting_bond_validate_option (name, value))
+ return FALSE;
priv = NM_SETTING_BOND_GET_PRIVATE (setting);
@@ -397,7 +404,9 @@ nm_setting_bond_remove_option (NMSettingBond *setting,
gboolean found;
g_return_val_if_fail (NM_IS_SETTING_BOND (setting), FALSE);
- g_return_val_if_fail (nm_setting_bond_validate_option (name, NULL), FALSE);
+
+ if (!nm_setting_bond_validate_option (name, NULL))
+ return FALSE;
found = g_hash_table_remove (NM_SETTING_BOND_GET_PRIVATE (setting)->options, name);
if (found)