summaryrefslogtreecommitdiffstats
path: root/src/conf-yaml-loader.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/conf-yaml-loader.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/conf-yaml-loader.c b/src/conf-yaml-loader.c
index ea64563..463eb2e 100644
--- a/src/conf-yaml-loader.c
+++ b/src/conf-yaml-loader.c
@@ -394,8 +394,19 @@ static int ConfYamlParse(yaml_parser_t *parser, ConfNode *parent, int inseq, int
if (inseq) {
char sequence_node_name[DEFAULT_NAME_LEN];
snprintf(sequence_node_name, DEFAULT_NAME_LEN, "%d", seq_idx++);
- ConfNode *seq_node = ConfNodeLookupChild(node,
- sequence_node_name);
+ ConfNode *seq_node = NULL;
+ if (was_empty < 0) {
+ // initialize was_empty
+ if (TAILQ_EMPTY(&node->head)) {
+ was_empty = 1;
+ } else {
+ was_empty = 0;
+ }
+ }
+ // we only check if the node's list was not empty at first
+ if (was_empty == 0) {
+ seq_node = ConfNodeLookupChild(node, sequence_node_name);
+ }
if (seq_node != NULL) {
/* The sequence node has already been set, probably
* from the command line. Remove it so it gets