diff options
author | Mary Ruthven <mruthven@google.com> | 2018-03-22 13:37:53 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-03-22 20:53:26 -0700 |
commit | 6e18f8f9813ed873a496cf49ab39dd9b41adc1bc (patch) | |
tree | 800b8ed78dbfef67a3454a61ee71a7a1577f315f /extra | |
parent | e33c1d8de03b936ed7dc67405ede9bcd747d07d2 (diff) | |
download | chrome-ec-6e18f8f9813ed873a496cf49ab39dd9b41adc1bc.tar.gz |
rma_reset: fix ignored return value error
The fread return value was ignored in rma_reset.c. This caused clang
compilation to fail.
This change checks the return value.
BUG=b:76105747
BRANCH=none
TEST=clang compilation no longer fails
Change-Id: I710b367008b2e17a94c875ea3eae92bcc75546b0
Signed-off-by: Mary Ruthven <mruthven@google.com>
Reviewed-on: https://chromium-review.googlesource.com/976555
Commit-Ready: Mary Ruthven <mruthven@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'extra')
-rw-r--r-- | extra/rma_reset/rma_reset.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/extra/rma_reset/rma_reset.c b/extra/rma_reset/rma_reset.c index 30a2e652cb..31b88b0bb2 100644 --- a/extra/rma_reset/rma_reset.c +++ b/extra/rma_reset/rma_reset.c @@ -452,6 +452,7 @@ int main(int argc, char **argv) if (a_flag) { FILE *acode; char verify_authcode[RMA_AUTHCODE_BUF_SIZE]; + int rv; acode = fopen("/tmp/authcode", "r"); if (acode == NULL) { @@ -459,7 +460,11 @@ int main(int argc, char **argv) return 1; } - fread(verify_authcode, 1, RMA_AUTHCODE_BUF_SIZE, acode); + rv = fread(verify_authcode, 1, RMA_AUTHCODE_BUF_SIZE, acode); + if (rv != RMA_AUTHCODE_BUF_SIZE) { + printf("Error reading saved authcode\n"); + return 1; + } if (strcmp(verify_authcode, authcode) == 0) printf("Code Accepted\n"); else |