summaryrefslogtreecommitdiff
path: root/cgpt
diff options
context:
space:
mode:
authorNam T. Nguyen <namnguyen@chromium.org>2015-01-26 12:55:05 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-27 00:22:11 +0000
commit9a8dfd00ecf042b7619f0fbbcb8308fce5cfd5c8 (patch)
treeb3bb1e8e07a221c86c8d0e6508c2f894d3bd1f10 /cgpt
parentf620c0d6560dcb5c6b6b004bd50f4713f191d381 (diff)
downloadvboot-9a8dfd00ecf042b7619f0fbbcb8308fce5cfd5c8.tar.gz
cgpt_wrapper: Fix non-zero return code when okay
I forgot to reset "ret" to zero in the case the two hashes come out the same. This CL fixes that silly logic bug. BUG=None BRANCH=None TEST=`cgpt show /dev/mtd0` should exit with status 0 Change-Id: I1c64ea215c861c8afb44e235d090c72a5d006d55 Reviewed-on: https://chromium-review.googlesource.com/243325 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Nam Nguyen <namnguyen@chromium.org> Trybot-Ready: Nam Nguyen <namnguyen@chromium.org> Tested-by: Nam Nguyen <namnguyen@chromium.org>
Diffstat (limited to 'cgpt')
-rw-r--r--cgpt/cgpt_wrapper.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/cgpt/cgpt_wrapper.c b/cgpt/cgpt_wrapper.c
index 50957ccb..f9288c15 100644
--- a/cgpt/cgpt_wrapper.c
+++ b/cgpt/cgpt_wrapper.c
@@ -125,9 +125,10 @@ static int wrap_cgpt(int argc,
// Write back "rw_gpt" to NOR flash in two chunks.
ret++;
modified_hash = DigestFile(rw_gpt_path, SHA1_DIGEST_ALGORITHM);
- if (original_hash != NULL && modified_hash != NULL &&
- memcmp(original_hash, modified_hash, SHA1_DIGEST_SIZE) != 0) {
- if (WriteNorFlash(temp_dir) == 0) {
+ if (original_hash != NULL && modified_hash != NULL) {
+ if (memcmp(original_hash, modified_hash, SHA1_DIGEST_SIZE) != 0) {
+ ret = WriteNorFlash(temp_dir);
+ } else {
ret = 0;
}
}