mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-06 17:30:35 +01:00
cli: fix accepting %NULL value for '+' modifier
I find it questionable, how nmcli likes to coerce the empty input to
NULL to indicate resetting the value. If nmcli would like to set a
default, it should use a different way of signalling that. Anyway, the
assertion was too strict.
$ nmcli connection modify "$PROFILE" +ipv4.addresses ''
This commit is contained in:
parent
02ae0fd00a
commit
598ecbc482
1 changed files with 6 additions and 1 deletions
|
|
@ -543,13 +543,18 @@ nmc_setting_set_property (NMClient *client,
|
|||
g_return_val_if_fail (NM_IS_SETTING (setting), FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
g_return_val_if_fail (NM_IN_SET (modifier, '\0', '-', '+'), FALSE);
|
||||
g_return_val_if_fail (value || modifier == '\0', FALSE);
|
||||
|
||||
if (!(property_info = nm_meta_property_info_find_by_setting (setting, prop)))
|
||||
goto out_fail_read_only;
|
||||
if (!property_info->property_type->set_fcn)
|
||||
goto out_fail_read_only;
|
||||
|
||||
if ( NM_IN_SET (modifier, '+', '-')
|
||||
&& !value) {
|
||||
/* nothing to do. */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ( modifier == '-'
|
||||
&& !property_info->property_type->set_supports_remove) {
|
||||
/* The property is a plain property. It does not support '-'.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue