=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/read.c,v retrieving revision 1.82 retrieving revision 1.83 diff -c -r1.82 -r1.83 *** src/usr.bin/mandoc/read.c 2015/01/14 17:45:25 1.82 --- src/usr.bin/mandoc/read.c 2015/01/14 22:02:00 1.83 *************** *** 1,4 **** ! /* $OpenBSD: read.c,v 1.82 2015/01/14 17:45:25 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010-2015 Ingo Schwarze --- 1,4 ---- ! /* $OpenBSD: read.c,v 1.83 2015/01/14 22:02:00 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010-2015 Ingo Schwarze *************** *** 186,191 **** --- 186,192 ---- "ignoring macro in table", /* related to document structure and macros */ + NULL, "input stack limit exceeded, infinite loop?", "skipping bad character", "skipping unknown macro", *************** *** 213,223 **** "input too large", "NOT IMPLEMENTED: .so with absolute path or \"..\"", ".so request failed", - - /* system errors */ - "gunzip failed with code", - NULL, - "gunzip died from signal", }; static const char * const mandoclevels[MANDOCLEVEL_MAX] = { --- 214,219 ---- *************** *** 753,759 **** save_child = curp->child; if (fd != -1) curp->child = 0; ! else if (mparse_open(curp, &fd, file) >= MANDOCLEVEL_SYSERR) goto out; if (read_whole_file(curp, file, fd, &blk, &with_mmap)) { --- 749,755 ---- save_child = curp->child; if (fd != -1) curp->child = 0; ! else if (mparse_open(curp, &fd, file) != MANDOCLEVEL_OK) goto out; if (read_whole_file(curp, file, fd, &blk, &with_mmap)) { *************** *** 783,791 **** int pfd[2]; int save_errno; char *cp; - enum mandocerr err; - pfd[1] = -1; curp->file = file; /* Unless zipped, try to just open the file. */ --- 779,785 ---- *************** *** 809,816 **** if (access(file, R_OK) == -1) { if (cp != NULL) errno = save_errno; ! err = MANDOCERR_SYSOPEN; ! goto out; } /* Run gunzip(1). */ --- 803,813 ---- if (access(file, R_OK) == -1) { if (cp != NULL) errno = save_errno; ! free(cp); ! *fd = -1; ! curp->child = 0; ! mandoc_msg(MANDOCERR_FILE, curp, 0, 0, strerror(errno)); ! return(MANDOCLEVEL_ERROR); } /* Run gunzip(1). */ *************** *** 838,855 **** *fd = pfd[0]; return(MANDOCLEVEL_OK); } - - out: - free(cp); - *fd = -1; - curp->child = 0; - curp->file_status = MANDOCLEVEL_SYSERR; - if (curp->mmsg) - (*curp->mmsg)(err, curp->file_status, curp->file, - 0, 0, strerror(errno)); - if (pfd[1] != -1) - exit(1); - return(curp->file_status); } enum mandoclevel --- 835,840 ---- *************** *** 865,880 **** exit((int)MANDOCLEVEL_SYSERR); } if (WIFSIGNALED(status)) { ! mandoc_vmsg(MANDOCERR_SYSSIG, curp, 0, 0, ! "%d", WTERMSIG(status)); ! curp->file_status = MANDOCLEVEL_SYSERR; ! return(curp->file_status); } if (WEXITSTATUS(status)) { ! mandoc_vmsg(MANDOCERR_SYSEXIT, curp, 0, 0, ! "%d", WEXITSTATUS(status)); ! curp->file_status = MANDOCLEVEL_SYSERR; ! return(curp->file_status); } return(MANDOCLEVEL_OK); } --- 850,863 ---- exit((int)MANDOCLEVEL_SYSERR); } if (WIFSIGNALED(status)) { ! mandoc_vmsg(MANDOCERR_FILE, curp, 0, 0, ! "gunzip died from signal %d", WTERMSIG(status)); ! return(MANDOCLEVEL_ERROR); } if (WEXITSTATUS(status)) { ! mandoc_vmsg(MANDOCERR_FILE, curp, 0, 0, ! "gunzip failed with code %d", WEXITSTATUS(status)); ! return(MANDOCLEVEL_ERROR); } return(MANDOCLEVEL_OK); } *************** *** 987,993 **** while (er < mandoclimits[level]) level--; ! if (level < m->wlevel) return; if (m->mmsg) --- 970,976 ---- while (er < mandoclimits[level]) level--; ! if (level < m->wlevel && er != MANDOCERR_FILE) return; if (m->mmsg)