diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-01-12 17:00:07 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-01-12 17:00:07 +0000 |
commit | b35c31f766657bf4a7337b30d10f61bd8b018af4 (patch) | |
tree | 1f096ed48e97658436aa6fe82591a1be5a21c8cf | |
parent | 3993f4018345b61b4de0132b521228ff054fc092 (diff) | |
download | mandoc-b35c31f766657bf4a7337b30d10f61bd8b018af4.tar.gz mandoc-b35c31f766657bf4a7337b30d10f61bd8b018af4.tar.zst mandoc-b35c31f766657bf4a7337b30d10f61bd8b018af4.zip |
Incorporate same fix for -man post-validation deletion of nodes. This
isn't known to cause any problems, but better safe than sorry.
-rw-r--r-- | mdoc_macro.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/mdoc_macro.c b/mdoc_macro.c index 1c97f88c..d41d6fd4 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_macro.c,v 1.99 2010/12/15 23:39:40 kristaps Exp $ */ +/* $Id: mdoc_macro.c,v 1.100 2011/01/12 17:00:07 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org> @@ -252,17 +252,24 @@ lookup_raw(const char *p) static int rew_last(struct mdoc *mdoc, const struct mdoc_node *to) { - struct mdoc_node *n; + struct mdoc_node *n, *np; assert(to); mdoc->next = MDOC_NEXT_SIBLING; /* LINTED */ while (mdoc->last != to) { + /* + * Save the parent here, because we may delete the + * m->last node in the post-validation phase and reset + * it to m->last->parent, causing a step in the closing + * out to be lost. + */ + np = mdoc->last->parent; if ( ! mdoc_valid_post(mdoc)) return(0); n = mdoc->last; - mdoc->last = mdoc->last->parent; + mdoc->last = np; assert(mdoc->last); mdoc->last->last = n; } |