From 0d731314b982258fbbbada6f4866f6fe08b650bd Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Tue, 13 Jan 2015 19:31:07 -0500 Subject: [PATCH] Fix Coverity issue #100342. --- src/crypto.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/crypto.c b/src/crypto.c index 94906a7e..fa77c24e 100644 --- a/src/crypto.c +++ b/src/crypto.c @@ -213,14 +213,14 @@ read_data_file (const char *filename, struct crypto_s * crypto) rlen = read (fd, crypto->grip, 20); if (rlen != 20) { - rc = rc == -1 ? gpg_error_from_errno (errno) : GPG_ERR_BAD_DATA; + rc = rlen == -1 ? gpg_error_from_errno (errno) : GPG_ERR_BAD_DATA; goto done; } rlen = read (fd, crypto->sign_grip, 20); if (rlen != 20) { - rc = rc == -1 ? gpg_error_from_errno (errno) : GPG_ERR_BAD_DATA; + rc = rlen == -1 ? gpg_error_from_errno (errno) : GPG_ERR_BAD_DATA; goto done; } } @@ -228,7 +228,7 @@ read_data_file (const char *filename, struct crypto_s * crypto) len = read (fd, crypto->ciphertext, crypto->hdr.datalen); if (len != crypto->hdr.datalen) { - rc = rc == -1 ? gpg_error_from_errno (errno) : GPG_ERR_BAD_DATA; + rc = len == -1 ? gpg_error_from_errno (errno) : GPG_ERR_BAD_DATA; goto done; } @@ -254,7 +254,7 @@ read_data_file (const char *filename, struct crypto_s * crypto) rlen = read (fd, buf, len); if (rlen != len) { - rc = rc == -1 ? gpg_error_from_errno (errno) : GPG_ERR_BAD_DATA; + rc = rlen == -1 ? gpg_error_from_errno (errno) : GPG_ERR_BAD_DATA; goto done; } -- 2.11.4.GIT