=================================================================== RCS file: /cvs/mandoc/cgi.c,v retrieving revision 1.54 retrieving revision 1.56 diff -u -p -r1.54 -r1.56 --- mandoc/cgi.c 2014/07/09 09:19:03 1.54 +++ mandoc/cgi.c 2014/07/09 11:34:46 1.56 @@ -1,4 +1,4 @@ -/* $Id: cgi.c,v 1.54 2014/07/09 09:19:03 schwarze Exp $ */ +/* $Id: cgi.c,v 1.56 2014/07/09 11:34:46 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2014 Ingo Schwarze @@ -683,7 +683,8 @@ format(const struct req *req, const char *file) return; } - mp = mparse_alloc(MPARSE_SO, MANDOCLEVEL_FATAL, NULL, NULL); + mp = mparse_alloc(MPARSE_SO, MANDOCLEVEL_FATAL, NULL, + req->q.manroot); rc = mparse_readfd(mp, fd, file); close(fd); @@ -940,6 +941,8 @@ pathgen(struct req *req) return; while (NULL != (dp = fgetln(fp, &dpsz))) { + if ('\n' == dp[dpsz - 1]) + dpsz--; req->p = mandoc_realloc(req->p, (req->psz + 1) * sizeof(char *)); req->p[req->psz++] = mandoc_strndup(dp, dpsz);