From faa52bdcc0221de2d8fae950e409a8ac5e05bfcd Mon Sep 17 00:00:00 2001 From: Aaron Marcher Date: Wed, 28 Mar 2018 19:46:27 +0200 Subject: Format error messages properly Make use of strerror(errno) and format all errors equally: function ['parameters']: error message --- util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'util.c') diff --git a/util.c b/util.c index cd3524b..6008ffc 100644 --- a/util.c +++ b/util.c @@ -1,4 +1,5 @@ /* See LICENSE file for copyright and license details. */ +#include #include #include #include @@ -29,7 +30,7 @@ pscanf(const char *path, const char *fmt, ...) int n; if (!(fp = fopen(path, "r"))) { - fprintf(stderr, "fopen for %s failed", path); + fprintf(stderr, "fopen '%s': %s\n", path, strerror(errno)); return -1; } va_start(ap, fmt); -- cgit v1.2.3