* mandoc: Do not call err(3) from the parser.
@ 2017-07-20 14:37 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2017-07-20 14:37 UTC (permalink / raw)
To: source
Log Message:
-----------
Do not call err(3) from the parser. Call mandoc_vmsg() and
return failure such that we can continue with the next file.
Modified Files:
--------------
mandoc:
read.c
Revision Data
-------------
Index: read.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/read.c,v
retrieving revision 1.191
retrieving revision 1.192
diff -Lread.c -Lread.c -u -p -r1.191 -r1.192
--- read.c
+++ read.c
@@ -24,9 +24,6 @@
#include <assert.h>
#include <ctype.h>
-#if HAVE_ERR
-#include <err.h>
-#endif
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
@@ -560,8 +557,11 @@ read_whole_file(struct mparse *curp, con
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
@@ -583,8 +583,11 @@ read_whole_file(struct mparse *curp, con
}
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;
@@ -613,8 +616,11 @@ read_whole_file(struct mparse *curp, con
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;
}
--
To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-07-20 14:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-20 14:37 mandoc: Do not call err(3) from the parser schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).