vboot2: Add host library functions to read/write files and objects

And unit tests for them.

Move roundup32() into hostlib.

Fix WriteFile() returning success even if it failed to write to the file.

BUG=chromium:423882
BRANCH=none
TEST=VBOOT2=1 make runtests

Change-Id: I8a115335c088dc5c66c88423d1ccbda7eaca1996
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/230844
This commit is contained in:
Randall Spangler
2014-11-19 12:48:36 -08:00
committed by chrome-internal-fetch
parent 8577b5360c
commit 02e11b323b
8 changed files with 238 additions and 10 deletions

View File

@@ -108,6 +108,7 @@ int WriteFile(const char* filename, const void *data, uint64_t size) {
VBDEBUG(("Unable to write to file %s\n", filename));
fclose(f);
unlink(filename); /* Delete any partial file */
return 1;
}
fclose(f);