Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(591)

Unified Diff: src/platform/vboot_reference/misclibs/file_keys.c

Issue 2351002: Better error messages, allow larger-than-needed input when reading. (Closed) Base URL: ssh://git@chromiumos-git/chromeos
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/platform/vboot_reference/misclibs/file_keys.c
diff --git a/src/platform/vboot_reference/misclibs/file_keys.c b/src/platform/vboot_reference/misclibs/file_keys.c
index 00b8d1345c17efd600fc6d08fb0773c7ac2bc4b3..c77743062f095c319ca28ac77d187e1452f3583d 100644
--- a/src/platform/vboot_reference/misclibs/file_keys.c
+++ b/src/platform/vboot_reference/misclibs/file_keys.c
@@ -25,24 +25,24 @@ uint8_t* BufferFromFile(const char* input_file, uint64_t* len) {
uint8_t* buf = NULL;
if ((fd = open(input_file, O_RDONLY)) == -1) {
- debug("Couldn't open file.\n");
+ debug("Couldn't open file %s\n", input_file);
return NULL;
}
if (-1 == fstat(fd, &stat_fd)) {
- debug("Couldn't stat file.\n");
+ debug("Couldn't stat file %s\n", input_file);
return NULL;
}
*len = stat_fd.st_size;
buf = (uint8_t*) Malloc(*len);
if (!buf) {
- error("Couldn't allocate %ld bytes.\n", *len);
+ error("Couldn't allocate %ld bytes for file %s\n", *len, input_file);
return NULL;
}
if (*len != read(fd, buf, *len)) {
- debug("Couldn't read file into a buffer.\n");
+ debug("Couldn't read file %s into a buffer\n", input_file);
return NULL;
}
@@ -67,7 +67,7 @@ uint8_t* DigestFile(char* input_file, int sig_algorithm) {
DigestContext ctx;
if( (input_fd = open(input_file, O_RDONLY)) == -1 ) {
- debug("Couldn't open input file.\n");
+ debug("Couldn't open %s\n", input_file);
return NULL;
}
DigestInit(&ctx, sig_algorithm);

Powered by Google App Engine
This is Rietveld 408576698