summaryrefslogtreecommitdiffstats
path: root/read.c
diff options
context:
space:
mode:
Diffstat (limited to 'read.c')
-rw-r--r--read.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/read.c b/read.c
index 42aaca7d..07e6ce50 100644
--- a/read.c
+++ b/read.c
@@ -307,6 +307,7 @@ mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start)
{
const struct tbl_span *span;
struct buf ln;
+ const char *save_file;
char *cp;
size_t pos; /* byte number in the ln buffer */
enum rofferr rr;
@@ -522,11 +523,14 @@ rerun:
*/
if (curp->secondary)
curp->secondary->sz -= pos + 1;
+ save_file = curp->file;
save_child = curp->child;
if (mparse_open(curp, &fd, ln.buf + of) ==
- MANDOCLEVEL_OK)
+ MANDOCLEVEL_OK) {
mparse_readfd(curp, fd, ln.buf + of);
- else {
+ curp->file = save_file;
+ } else {
+ curp->file = save_file;
mandoc_vmsg(MANDOCERR_SO_FAIL,
curp, curp->line, pos,
".so %s", ln.buf + of);