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 | b9b8f8cdfe53fa8d9f13f22beb2ec50f83a231d8 (patch) | |
tree | 38681ddd25754f665454ebc7302fe4fdbf4d1980 | |
parent | 4f91378ad02e8f45eb622157ec28b4b7b95ccb63 (diff) | |
download | mandoc-b9b8f8cdfe53fa8d9f13f22beb2ec50f83a231d8.tar.gz |
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 | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/mdoc_macro.c b/mdoc_macro.c index 79cededd..55cdc2e5 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -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; } |