diff options
author | David Benjamin <davidben@chromium.org> | 2015-08-28 22:39:49 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2015-08-29 01:46:40 +0300 |
commit | ffadb3969f7e739ad3f8ccde67508f065d154fd1 (patch) | |
tree | 4561e5e7193d7fdf5362a3255f665f82049a8b99 /crypto/bio | |
parent | 26416e9dde31f0edaa24c13579846df651c0e23d (diff) |
fread returns a size_t, not int.
Change-Id: I305fd40a887b1dedf23eeddfb5231fc61b355ea8
Reviewed-on: https://boringssl-review.googlesource.com/5762
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/bio')
-rw-r--r-- | crypto/bio/file.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/crypto/bio/file.c b/crypto/bio/file.c index cef33b66..2d3ccfea 100644 --- a/crypto/bio/file.c +++ b/crypto/bio/file.c @@ -182,20 +182,19 @@ static int file_free(BIO *bio) { } static int file_read(BIO *b, char *out, int outl) { - int ret = 0; - if (!b->init) { return 0; } - ret = fread(out, 1, outl, (FILE *)b->ptr); + size_t ret = fread(out, 1, outl, (FILE *)b->ptr); if (ret == 0 && ferror((FILE *)b->ptr)) { OPENSSL_PUT_SYSTEM_ERROR(fread); OPENSSL_PUT_ERROR(BIO, ERR_R_SYS_LIB); - ret = -1; + return -1; } - return ret; + /* fread reads at most |outl| bytes, so |ret| fits in an int. */ + return (int)ret; } static int file_write(BIO *b, const char *in, int inl) { |