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>
This commit is contained in:
Thomas Haller
2013-10-09 11:26:55 +02:00
parent df4e159728
commit 0c6a98df78

View File

@@ -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)