summaryrefslogtreecommitdiff
path: root/usr.bin/yacc
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2020-05-24 18:27:08 +0000
committerMarc Espie <espie@cvs.openbsd.org>2020-05-24 18:27:08 +0000
commite768f823eb4322fe181839276d26d937dfed635d (patch)
tree391dc91467943b74370b1162e4f2be48aacbc94a /usr.bin/yacc
parent6ad60b6ea96f7f689dd3a9146930c3157c224ae0 (diff)
annotate I/O errors with the corresponding message
(a full switch to err(3) would involve significant message changes) okay millert@
Diffstat (limited to 'usr.bin/yacc')
-rw-r--r--usr.bin/yacc/error.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/usr.bin/yacc/error.c b/usr.bin/yacc/error.c
index 42d864ead81..bd2b2fbccca 100644
--- a/usr.bin/yacc/error.c
+++ b/usr.bin/yacc/error.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: error.c,v 1.16 2020/05/24 17:31:54 espie Exp $ */
+/* $OpenBSD: error.c,v 1.17 2020/05/24 18:27:07 espie Exp $ */
/* $NetBSD: error.c,v 1.4 1996/03/19 03:21:32 jtc Exp $ */
/*
@@ -36,6 +36,7 @@
/* routines for printing error messages */
#include "defs.h"
+#include <errno.h>
void
@@ -57,24 +58,24 @@ no_space(void)
void
open_error(char *filename)
{
- fprintf(stderr, "%s: cannot open source file %s\n",
- input_file_name, filename);
+ fprintf(stderr, "%s: cannot open source file %s: %s\n",
+ input_file_name, filename, strerror(errno));
exit(2);
}
void
tempfile_error(void)
{
- fprintf(stderr, "%s: cannot create temporary file\n",
- input_file_name);
+ fprintf(stderr, "%s: cannot create temporary file: %s\n",
+ input_file_name, strerror(errno));
exit(2);
}
void
open_write_error(char *filename)
{
- fprintf(stderr, "%s: cannot open target file %s for writing\n",
- input_file_name, filename);
+ fprintf(stderr, "%s: cannot open target file %s for writing: %s\n",
+ input_file_name, filename, strerror(errno));
exit(2);
}