schema tree BUGFIX do not apply augments twice
Happened when an imported module with self-augments
was loaded and then later set to implemented.
diff --git a/src/tree_schema.c b/src/tree_schema.c
index a390a6b..c05ad03 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -3289,7 +3289,8 @@
for (i = 0; i < module->augment_size; i++) {
/* apply augment */
- if (unres_schema_add_node(module, unres, &module->augment[i], UNRES_AUGMENT, NULL) == -1) {
+ if (!module->augment[i].target
+ && (unres_schema_add_node(module, unres, &module->augment[i], UNRES_AUGMENT, NULL) == -1)) {
return -1;
}
}
@@ -3387,8 +3388,9 @@
}
for (j = 0; j < module->inc[i].submodule->augment_size; j++) {
/* apply augment */
- if (unres_schema_add_node((struct lys_module *)module->inc[i].submodule, unres,
- &module->inc[i].submodule->augment[i], UNRES_AUGMENT, NULL) == -1) {
+ if (!module->inc[i].submodule->augment[i].target
+ && (unres_schema_add_node((struct lys_module *)module->inc[i].submodule, unres,
+ &module->inc[i].submodule->augment[i], UNRES_AUGMENT, NULL) == -1)) {
goto error;
}
}