=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/read.c,v retrieving revision 1.163 retrieving revision 1.164 diff -u -r1.163 -r1.164 --- src/usr.bin/mandoc/read.c 2017/07/08 17:52:42 1.163 +++ src/usr.bin/mandoc/read.c 2017/07/20 14:36:32 1.164 @@ -1,4 +1,4 @@ -/* $OpenBSD: read.c,v 1.163 2017/07/08 17:52:42 schwarze Exp $ */ +/* $OpenBSD: read.c,v 1.164 2017/07/20 14:36:32 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010-2017 Ingo Schwarze @@ -22,7 +22,6 @@ #include #include -#include #include #include #include @@ -556,8 +555,11 @@ size_t off; ssize_t ssz; - if (fstat(fd, &st) == -1) - err((int)MANDOCLEVEL_SYSERR, "%s", file); + if (fstat(fd, &st) == -1) { + mandoc_vmsg(MANDOCERR_FILE, curp, 0, 0, + "fstat: %s", strerror(errno)); + return 0; + } /* * If we're a regular file, try just reading in the whole entry @@ -579,8 +581,11 @@ } if (curp->gzip) { - if ((gz = gzdopen(fd, "rb")) == NULL) - err((int)MANDOCLEVEL_SYSERR, "%s", file); + if ((gz = gzdopen(fd, "rb")) == NULL) { + mandoc_vmsg(MANDOCERR_FILE, curp, 0, 0, + "gzdopen: %s", strerror(errno)); + return 0; + } } else gz = NULL; @@ -609,8 +614,11 @@ fb->sz = off; return 1; } - if (ssz == -1) - err((int)MANDOCLEVEL_SYSERR, "%s", file); + if (ssz == -1) { + mandoc_vmsg(MANDOCERR_FILE, curp, 0, 0, + "read: %s", strerror(errno)); + break; + } off += (size_t)ssz; }