aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorBen Laurie <ben@openssl.org>2002-06-11 12:41:37 +0000
committerBen Laurie <ben@openssl.org>2002-06-11 12:41:37 +0000
commitd15711efc6c82d5483dcf73ac7fa3ec5deb2c24a (patch)
tree4684ef0ec0db6e352b36006f98b1682a13fab9d7 /crypto
parent25ace3ed252a468d4d2b914a54863b2d539bb0b9 (diff)
downloadopenssl-d15711efc6c82d5483dcf73ac7fa3ec5deb2c24a.tar.gz
Handle read errors.
Diffstat (limited to 'crypto')
-rw-r--r--crypto/bio/bio.h1
-rw-r--r--crypto/bio/bio_err.c1
-rw-r--r--crypto/bio/bss_file.c6
-rw-r--r--crypto/err/err.c1
-rw-r--r--crypto/err/err.h1
5 files changed, 10 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);
}
diff --git a/crypto/err/err.c b/crypto/err/err.c
index 04773d65a6..5abe44e6d5 100644
--- a/crypto/err/err.c
+++ b/crypto/err/err.c
@@ -166,6 +166,7 @@ static ERR_STRING_DATA ERR_str_functs[]=
{ERR_PACK(0,SYS_F_WSASTARTUP,0), "WSAstartup"},
#endif
{ERR_PACK(0,SYS_F_OPENDIR,0), "opendir"},
+ {ERR_PACK(0,SYS_F_FREAD,0), "fread"},
{0,NULL},
};
diff --git a/crypto/err/err.h b/crypto/err/err.h
index 76dc9e45d4..8728ff7c02 100644
--- a/crypto/err/err.h
+++ b/crypto/err/err.h
@@ -184,6 +184,7 @@ typedef struct err_state_st
#define SYS_F_ACCEPT 8
#define SYS_F_WSASTARTUP 9 /* Winsock stuff */
#define SYS_F_OPENDIR 10
+#define SYS_F_FREAD 11
/* reasons */