From e768f823eb4322fe181839276d26d937dfed635d Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Sun, 24 May 2020 18:27:08 +0000 Subject: annotate I/O errors with the corresponding message (a full switch to err(3) would involve significant message changes) okay millert@ --- usr.bin/yacc/error.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'usr.bin/yacc') 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 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); } -- cgit v1.2.3