don't record a changed value if the new value matches the old one
authorFelix Fietkau <nbd@openwrt.org>
Wed, 4 Jun 2008 15:25:03 +0000 (17:25 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Wed, 4 Jun 2008 15:25:03 +0000 (17:25 +0200)
list.c

diff --git a/list.c b/list.c
index 99b3ab95592d3eec1011fb3fade22eaeab5f3e95..67bde395abf3ca3a56b8d725bd4e95f5d74abc3d 100644 (file)
--- a/list.c
+++ b/list.c
@@ -341,6 +341,9 @@ int uci_set_element_value(struct uci_context *ctx, struct uci_element **element,
                s = uci_to_section(e);
                section = e->name;
                option = NULL;
+               /* matches the currently set value */
+               if (!strcmp(value, s->type))
+                       return 0;
                break;
        case UCI_TYPE_OPTION:
                UCI_ASSERT(ctx, value != NULL);
@@ -348,6 +351,9 @@ int uci_set_element_value(struct uci_context *ctx, struct uci_element **element,
                s = uci_to_option(e)->section;
                section = s->e.name;
                option = e->name;
+               /* matches the currently set value */
+               if (!strcmp(value, e->name))
+                       return 0;
                break;
        default:
                UCI_THROW(ctx, UCI_ERR_INVAL);