JSON Plugin: don't return error when trying to delete a uci list parameter and its actual value is empty

This commit is contained in:
Amin Ben Romdhane 2023-03-21 12:00:37 +01:00
parent 579e04e2c4
commit 70459eb4ad

View file

@ -1381,11 +1381,8 @@ static int uci_set_value(json_object *mapping_obj, int json_version, char *refpa
res = dmuci_set_value(json_object_get_string(file), uci_type, opt_temp, linker);
} else {
if (value != NULL) {
if ((res = dmuci_delete_by_section((struct uci_section *)data, opt_temp, NULL)))
res = dmuci_delete(json_object_get_string(file), uci_type, opt_temp, NULL);
if (res)
return -1;
if (dmuci_delete_by_section((struct uci_section *)data, opt_temp, NULL))
dmuci_delete(json_object_get_string(file), uci_type, opt_temp, NULL);
char *p = strtok(value, ",");
while (p) {
@ -1411,8 +1408,7 @@ static int uci_set_value(json_object *mapping_obj, int json_version, char *refpa
res = dmuci_set_value(json_object_get_string(file), json_object_get_string(section_name), opt_temp, linker);
} else {
if (value != NULL) {
if (dmuci_delete(json_object_get_string(file), json_object_get_string(section_name), opt_temp, NULL))
return -1;
dmuci_delete(json_object_get_string(file), json_object_get_string(section_name), opt_temp, NULL);
char *p = strtok(value, ",");
while (p) {