summaryrefslogtreecommitdiffstats
path: root/src/rule.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2014-02-05 19:03:40 +0000
committerPatrick McHardy <kaber@trash.net>2014-02-05 19:09:46 +0000
commit782d57968590186e8f85b2310092d6008b00ac2c (patch)
treef038de56859b29b7491024823c5de47c591bf16b /src/rule.c
parent4b85c9d6bb5beb210dd59c74144c1fb05fa5c020 (diff)
cmd: initialize cmd list and use list_splice_tail() for adding to command list
With incremental evaluation we're first evaluating the command before adding it to the global command list, so the command's list_head is uninitialized during evaluation. We need to initialize it to handle the case that an implicit set declaration will prepend a command to the list. Also list_splice_tail() needs to be used instead of list_add_tail() to add the entire list of commands. Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'src/rule.c')
-rw-r--r--src/rule.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/rule.c b/src/rule.c
index 657695a6..ab96e62e 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -426,6 +426,7 @@ struct cmd *cmd_alloc(enum cmd_ops op, enum cmd_obj obj,
struct cmd *cmd;
cmd = xzalloc(sizeof(*cmd));
+ init_list_head(&cmd->list);
cmd->op = op;
cmd->obj = obj;
cmd->handle = *h;