1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-03 06:45:37 -08:00

annotate I/O errors with the corresponding message

(a full switch to err(3) would involve significant message changes)

okay millert@
This commit is contained in:
espie 2020-05-24 18:27:07 +00:00
parent 906c90c3e8
commit 3642470f4e

View File

@ -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 $ */ /* $NetBSD: error.c,v 1.4 1996/03/19 03:21:32 jtc Exp $ */
/* /*
@ -36,6 +36,7 @@
/* routines for printing error messages */ /* routines for printing error messages */
#include "defs.h" #include "defs.h"
#include <errno.h>
void void
@ -57,24 +58,24 @@ no_space(void)
void void
open_error(char *filename) open_error(char *filename)
{ {
fprintf(stderr, "%s: cannot open source file %s\n", fprintf(stderr, "%s: cannot open source file %s: %s\n",
input_file_name, filename); input_file_name, filename, strerror(errno));
exit(2); exit(2);
} }
void void
tempfile_error(void) tempfile_error(void)
{ {
fprintf(stderr, "%s: cannot create temporary file\n", fprintf(stderr, "%s: cannot create temporary file: %s\n",
input_file_name); input_file_name, strerror(errno));
exit(2); exit(2);
} }
void void
open_write_error(char *filename) open_write_error(char *filename)
{ {
fprintf(stderr, "%s: cannot open target file %s for writing\n", fprintf(stderr, "%s: cannot open target file %s for writing: %s\n",
input_file_name, filename); input_file_name, filename, strerror(errno));
exit(2); exit(2);
} }