summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.c2
-rw-r--r--read.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/main.c b/main.c
index 400e7e65..1484eb90 100644
--- a/main.c
+++ b/main.c
@@ -561,7 +561,7 @@ main(int argc, char *argv[])
}
} else
mandoc_msg(MANDOCERR_FILE, 0, 0,
- "%s", strerror(errno));
+ "%s: %s", thisarg, strerror(errno));
if (curp.wstop && mandoc_msg_getrc() != MANDOCLEVEL_OK)
break;
diff --git a/read.c b/read.c
index 22c502c6..14f9a74e 100644
--- a/read.c
+++ b/read.c
@@ -1,7 +1,7 @@
/* $Id$ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010-2018 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010-2019 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2010, 2012 Joerg Sonnenberger <joerg@netbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
@@ -607,7 +607,7 @@ int
mparse_open(struct mparse *curp, const char *file)
{
char *cp;
- int fd;
+ int fd, save_errno;
cp = strrchr(file, '.');
curp->gzip = (cp != NULL && ! strcmp(cp + 1, "gz"));
@@ -623,9 +623,11 @@ mparse_open(struct mparse *curp, const char *file)
*/
if ( ! curp->gzip) {
+ save_errno = errno;
mandoc_asprintf(&cp, "%s.gz", file);
fd = open(cp, O_RDONLY);
free(cp);
+ errno = save_errno;
if (fd != -1) {
curp->gzip = 1;
return fd;