We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6edf345 commit 08f3ad9Copy full SHA for 08f3ad9
src/diff.c
@@ -128,12 +128,16 @@ lyd_diff_add_create_nested_userord(struct lyd_node *node)
128
meta_name = "yang:position";
129
130
pos = lyd_list_pos(node);
131
- if (asprintf(&dyn, "%" PRIu32, pos) == -1) {
132
- LOGMEM(LYD_CTX(node));
133
- rc = LY_EMEM;
134
- goto cleanup;
+ if (pos > 1) {
+ if (asprintf(&dyn, "%" PRIu32, pos - 1) == -1) {
+ LOGMEM(LYD_CTX(node));
+ rc = LY_EMEM;
135
+ goto cleanup;
136
+ }
137
+ meta_val = dyn;
138
+ } else {
139
+ meta_val = "";
140
}
- meta_val = dyn;
141
} else if (node->schema->nodetype == LYS_LIST) {
142
meta_name = "yang:key";
143
0 commit comments