=================================================================== RCS file: /cvs/mandoc/read.c,v retrieving revision 1.126 retrieving revision 1.132 diff -u -p -r1.126 -r1.132 --- mandoc/read.c 2015/02/06 16:06:25 1.126 +++ mandoc/read.c 2015/03/17 07:33:07 1.132 @@ -1,4 +1,4 @@ -/* $Id: read.c,v 1.126 2015/02/06 16:06:25 schwarze Exp $ */ +/* $Id: read.c,v 1.132 2015/03/17 07:33:07 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010-2015 Ingo Schwarze @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -109,7 +110,10 @@ static const char * const mandocerrs[MANDOCERR_MAX] = "no document body", "content before first section header", "first section is not \"NAME\"", - "bad NAME section contents", + "NAME section without name", + "NAME section without description", + "description not at the end of NAME", + "bad NAME section content", "missing description line, using \"\"", "sections out of conventional order", "duplicate section title", @@ -399,7 +403,8 @@ mparse_buf_r(struct mparse *curp, struct buf blk, size MANDOCERR_CHAR_UNSUPP, curp, curp->line, pos, "0x%x", c); i++; - ln.buf[pos++] = '?'; + if (c != '\r') + ln.buf[pos++] = '?'; continue; } @@ -632,7 +637,7 @@ read_whole_file(struct mparse *curp, const char *file, */ if (S_ISREG(st.st_mode)) { - if (st.st_size >= (1U << 31)) { + if (st.st_size > 0x7fffffff) { mandoc_msg(MANDOCERR_TOOLARGE, curp, 0, 0, NULL); return(0); } @@ -842,6 +847,7 @@ mparse_open(struct mparse *curp, int *fd, const char * perror("dup"); exit((int)MANDOCLEVEL_SYSERR); } + signal(SIGPIPE, SIG_DFL); execlp("gunzip", "gunzip", "-c", file, NULL); perror("exec"); exit((int)MANDOCLEVEL_SYSERR); @@ -864,6 +870,7 @@ mparse_wait(struct mparse *curp) perror("wait"); exit((int)MANDOCLEVEL_SYSERR); } + curp->child = 0; if (WIFSIGNALED(status)) { mandoc_vmsg(MANDOCERR_FILE, curp, 0, 0, "gunzip died from signal %d", WTERMSIG(status));