summaryrefslogtreecommitdiff
path: root/flashrom.c
diff options
context:
space:
mode:
authorstefanct <stefanct@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2013-04-07 13:08:30 +0000
committerstefanct <stefanct@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2013-04-07 13:08:30 +0000
commit3b3c4b3bb823266799c2914c0e6f057f43420cd8 (patch)
tree917a00cb091798c90273bf5d45bb86e4160de46a /flashrom.c
parentb0000b919c1716206d81232a2269ddb816d58e85 (diff)
downloadflashrom-3b3c4b3bb823266799c2914c0e6f057f43420cd8.tar.gz
Get rid of perror().
It prints to stderr and that's not what we want necesserily; using msg_*err gives us more control. Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@1668 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'flashrom.c')
-rw-r--r--flashrom.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/flashrom.c b/flashrom.c
index 14bb1b3..c11f723 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -29,6 +29,7 @@
#endif
#include <string.h>
#include <stdlib.h>
+#include <errno.h>
#include <ctype.h>
#include <getopt.h>
#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;
}