From 624372239eb4cd5cc6baddd58968e52cad4dff24 Mon Sep 17 00:00:00 2001 From: Fernando Fernandez Mancera Date: Thu, 25 Nov 2021 17:51:55 +0100 Subject: [PATCH] nmcli: fix "remove" command to really remove the property When using the "remove" command on nmcli edit mode it will reset the value to the default when no property value is specified. If the property value is specified it will remove that specific property. Example: ``` nmcli> set ethernet.wake-on-lan phy nmcli> print ethernet.wake-on-lan 802-3-ethernet.wake-on-lan: phy, default nmcli> remove ethernet.wake-on-lan default nmcli> print ethernet.wake-on-lan 802-3-ethernet.wake-on-lan: phy nmcli> remove ethernet.wake-on-lan nmcli> print ethernet.wake-on-lan 802-3-ethernet.wake-on-lan: default ``` --- src/nmcli/connections.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/nmcli/connections.c b/src/nmcli/connections.c index ed5b6450ab..98d50c8656 100644 --- a/src/nmcli/connections.c +++ b/src/nmcli/connections.c @@ -8005,8 +8005,9 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty if (!nmc_setting_set_property(nmc->client, ss, prop_name, - NM_META_ACCESSOR_MODIFIER_SET, - NULL, + cmd_arg_v ? NM_META_ACCESSOR_MODIFIER_DEL + : NM_META_ACCESSOR_MODIFIER_SET, + cmd_arg_v ? cmd_arg_v : NULL, &tmp_err)) { g_print(_("Error: failed to remove value of '%s': %s\n"), prop_name,