From 363fd7e827e3b630f916f9d2bdda262180274789 Mon Sep 17 00:00:00 2001 From: Stefan Tauner Date: Sun, 7 Apr 2013 13:08:30 +0000 Subject: Get rid of perror() It prints to stderr and that's not what we want necesserily; using msg_*err gives us more control. Corresponding to flashrom svn r1668. Signed-off-by: Stefan Tauner Acked-by: Carl-Daniel Hailfinger --- flashrom.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'flashrom.c') diff --git a/flashrom.c b/flashrom.c index 14bb1b33..c11f7235 100644 --- a/flashrom.c +++ b/flashrom.c @@ -29,6 +29,7 @@ #endif #include #include +#include #include #include #if HAVE_UTSNAME == 1 @@ -1158,11 +1159,11 @@ int read_buf_from_file(unsigned char *buf, unsigned long size, struct stat image_stat; if ((image = fopen(filename, "rb")) == NULL) { - perror(filename); + msg_gerr("Error: opening file \"%s\" failed: %s\n", filename, strerror(errno)); return 1; } if (fstat(fileno(image), &image_stat) != 0) { - perror(filename); + msg_gerr("Error: getting metadata of file \"%s\" failed: %s\n", filename, strerror(errno)); fclose(image); return 1; } @@ -1174,7 +1175,7 @@ int read_buf_from_file(unsigned char *buf, unsigned long size, } numbytes = fread(buf, 1, size, image); if (fclose(image)) { - perror(filename); + msg_gerr("Error: closing file \"%s\" failed: %s\n", filename, strerror(errno)); return 1; } if (numbytes != size) { @@ -1196,7 +1197,7 @@ int write_buf_to_file(unsigned char *buf, unsigned long size, return 1; } if ((image = fopen(filename, "wb")) == NULL) { - perror(filename); + msg_gerr("Error: opening file \"%s\" failed: %s\n", filename, strerror(errno)); return 1; } -- cgit v1.2.3