version 1.191, 2017/07/08 17:52:50 |
version 1.192, 2017/07/20 14:36:36 |
|
|
|
|
#include <assert.h> |
#include <assert.h> |
#include <ctype.h> |
#include <ctype.h> |
#if HAVE_ERR |
|
#include <err.h> |
|
#endif |
|
#include <errno.h> |
#include <errno.h> |
#include <fcntl.h> |
#include <fcntl.h> |
#include <stdarg.h> |
#include <stdarg.h> |
Line 560 read_whole_file(struct mparse *curp, const char *file, |
|
Line 557 read_whole_file(struct mparse *curp, const char *file, |
|
size_t off; |
size_t off; |
ssize_t ssz; |
ssize_t ssz; |
|
|
if (fstat(fd, &st) == -1) |
if (fstat(fd, &st) == -1) { |
err((int)MANDOCLEVEL_SYSERR, "%s", file); |
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 |
* If we're a regular file, try just reading in the whole entry |
Line 583 read_whole_file(struct mparse *curp, const char *file, |
|
Line 583 read_whole_file(struct mparse *curp, const char *file, |
|
} |
} |
|
|
if (curp->gzip) { |
if (curp->gzip) { |
if ((gz = gzdopen(fd, "rb")) == NULL) |
if ((gz = gzdopen(fd, "rb")) == NULL) { |
err((int)MANDOCLEVEL_SYSERR, "%s", file); |
mandoc_vmsg(MANDOCERR_FILE, curp, 0, 0, |
|
"gzdopen: %s", strerror(errno)); |
|
return 0; |
|
} |
} else |
} else |
gz = NULL; |
gz = NULL; |
|
|
Line 613 read_whole_file(struct mparse *curp, const char *file, |
|
Line 616 read_whole_file(struct mparse *curp, const char *file, |
|
fb->sz = off; |
fb->sz = off; |
return 1; |
return 1; |
} |
} |
if (ssz == -1) |
if (ssz == -1) { |
err((int)MANDOCLEVEL_SYSERR, "%s", file); |
mandoc_vmsg(MANDOCERR_FILE, curp, 0, 0, |
|
"read: %s", strerror(errno)); |
|
break; |
|
} |
off += (size_t)ssz; |
off += (size_t)ssz; |
} |
} |
|
|