summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2014-02-06 17:20:11 +0000
committerPatrick McHardy <kaber@trash.net>2014-02-06 17:20:16 +0000
commitf534b9a7ca87cd3b170b6bb22449e51361d2a9e3 (patch)
tree4a8013d7530fe196f54b4a4b07d3cff42ca5ca86
parenta144995d3920516f95e0d88ed3fd3e0240e87467 (diff)
eval: use list_splice_tail() properly
We need a real list_head to splice both the command and potential new commands added during evaluation. Signed-off-by: Patrick McHardy <kaber@trash.net>
-rw-r--r--src/parser.y11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/parser.y b/src/parser.y
index 2050f8a3..07613e21 100644
--- a/src/parser.y
+++ b/src/parser.y
@@ -492,12 +492,16 @@ input : /* empty */
| input line
{
if ($2 != NULL) {
+ LIST_HEAD(list);
+
$2->location = @2;
+
+ list_add_tail(&$2->list, &list);
if (cmd_evaluate(&state->ectx, $2) < 0) {
if (++state->nerrs == max_errors)
YYABORT;
} else
- list_splice_tail(&$2->list, &state->cmds);
+ list_splice_tail(&list, &state->cmds);
}
}
;
@@ -554,13 +558,16 @@ line : common_block { $$ = NULL; }
* work.
*/
if ($1 != NULL) {
+ LIST_HEAD(list);
+
$1->location = @1;
+ list_add_tail(&$1->list, &list);
if (cmd_evaluate(&state->ectx, $1) < 0) {
if (++state->nerrs == max_errors)
YYABORT;
} else
- list_splice_tail(&$1->list, &state->cmds);
+ list_splice_tail(&list, &state->cmds);
}
$$ = NULL;