diff options
author | Ben Laurie <ben@openssl.org> | 2002-06-11 12:41:37 +0000 |
---|---|---|
committer | Ben Laurie <ben@openssl.org> | 2002-06-11 12:41:37 +0000 |
commit | d15711efc6c82d5483dcf73ac7fa3ec5deb2c24a (patch) | |
tree | 4684ef0ec0db6e352b36006f98b1682a13fab9d7 /crypto/bio | |
parent | 25ace3ed252a468d4d2b914a54863b2d539bb0b9 (diff) |
Handle read errors.
Diffstat (limited to 'crypto/bio')
-rw-r--r-- | crypto/bio/bio.h | 1 | ||||
-rw-r--r-- | crypto/bio/bio_err.c | 1 | ||||
-rw-r--r-- | crypto/bio/bss_file.c | 6 |
3 files changed, 8 insertions, 0 deletions
diff --git a/crypto/bio/bio.h b/crypto/bio/bio.h index b122c7069d..8aefeac3d7 100644 --- a/crypto/bio/bio.h +++ b/crypto/bio/bio.h @@ -647,6 +647,7 @@ void ERR_load_BIO_strings(void); #define BIO_F_CONN_CTRL 127 #define BIO_F_CONN_STATE 115 #define BIO_F_FILE_CTRL 116 +#define BIO_F_FILE_READ 130 #define BIO_F_LINEBUFFER_CTRL 129 #define BIO_F_MEM_READ 128 #define BIO_F_MEM_WRITE 117 diff --git a/crypto/bio/bio_err.c b/crypto/bio/bio_err.c index 99ca3cd0da..68a119d895 100644 --- a/crypto/bio/bio_err.c +++ b/crypto/bio/bio_err.c @@ -91,6 +91,7 @@ static ERR_STRING_DATA BIO_str_functs[]= {ERR_PACK(0,BIO_F_CONN_CTRL,0), "CONN_CTRL"}, {ERR_PACK(0,BIO_F_CONN_STATE,0), "CONN_STATE"}, {ERR_PACK(0,BIO_F_FILE_CTRL,0), "FILE_CTRL"}, +{ERR_PACK(0,BIO_F_FILE_READ,0), "FILE_READ"}, {ERR_PACK(0,BIO_F_LINEBUFFER_CTRL,0), "LINEBUFFER_CTRL"}, {ERR_PACK(0,BIO_F_MEM_READ,0), "MEM_READ"}, {ERR_PACK(0,BIO_F_MEM_WRITE,0), "MEM_WRITE"}, diff --git a/crypto/bio/bss_file.c b/crypto/bio/bss_file.c index 8b3ff278d9..826b361fa2 100644 --- a/crypto/bio/bss_file.c +++ b/crypto/bio/bss_file.c @@ -162,6 +162,12 @@ static int MS_CALLBACK file_read(BIO *b, char *out, int outl) if (b->init && (out != NULL)) { ret=fread(out,1,(int)outl,(FILE *)b->ptr); + if(ret == 0 && ferror((FILE *)b->ptr)) + { + SYSerr(SYS_F_FREAD,get_last_sys_error()); + BIOerr(BIO_F_FILE_READ,ERR_R_SYS_LIB); + ret=-1; + } } return(ret); } |