diff options
author | Ben Laurie <ben@openssl.org> | 2000-08-28 12:54:18 +0000 |
---|---|---|
committer | Ben Laurie <ben@openssl.org> | 2000-08-28 12:54:18 +0000 |
commit | b3756cf0e9622a4bbda5e4c417248255ba9daaf2 (patch) | |
tree | 779415f5a3573f129e7d463563da44ffc84f5d04 /crypto/bio | |
parent | 065866b28d95b670b63a0ccf47cd0db2064a1b3d (diff) |
Diagnose EOF on memory BIOs (or you just get mysterious errors with no error
message).
Diffstat (limited to 'crypto/bio')
-rw-r--r-- | crypto/bio/bio.h | 2 | ||||
-rw-r--r-- | crypto/bio/bio_err.c | 2 | ||||
-rw-r--r-- | crypto/bio/bss_mem.c | 2 |
3 files changed, 6 insertions, 0 deletions
diff --git a/crypto/bio/bio.h b/crypto/bio/bio.h index c7273932e7..0e1a16ce62 100644 --- a/crypto/bio/bio.h +++ b/crypto/bio/bio.h @@ -638,6 +638,7 @@ int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args); #define BIO_F_CONN_CTRL 127 #define BIO_F_CONN_STATE 115 #define BIO_F_FILE_CTRL 116 +#define BIO_F_MEM_READ 128 #define BIO_F_MEM_WRITE 117 #define BIO_F_SSL_NEW 118 #define BIO_F_WSASTARTUP 119 @@ -648,6 +649,7 @@ int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args); #define BIO_R_BAD_HOSTNAME_LOOKUP 102 #define BIO_R_BROKEN_PIPE 124 #define BIO_R_CONNECT_ERROR 103 +#define BIO_R_EOF_ON_MEMORY_BIO 127 #define BIO_R_ERROR_SETTING_NBIO 104 #define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET 105 #define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET 106 diff --git a/crypto/bio/bio_err.c b/crypto/bio/bio_err.c index f38e7b9178..1d6a0e733f 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_MEM_READ,0), "MEM_READ"}, {ERR_PACK(0,BIO_F_MEM_WRITE,0), "MEM_WRITE"}, {ERR_PACK(0,BIO_F_SSL_NEW,0), "SSL_new"}, {ERR_PACK(0,BIO_F_WSASTARTUP,0), "WSASTARTUP"}, @@ -104,6 +105,7 @@ static ERR_STRING_DATA BIO_str_reasons[]= {BIO_R_BAD_HOSTNAME_LOOKUP ,"bad hostname lookup"}, {BIO_R_BROKEN_PIPE ,"broken pipe"}, {BIO_R_CONNECT_ERROR ,"connect error"}, +{BIO_R_EOF_ON_MEMORY_BIO ,"eof on memory bio"}, {BIO_R_ERROR_SETTING_NBIO ,"error setting nbio"}, {BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET,"error setting nbio on accepted socket"}, {BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET,"error setting nbio on accept socket"}, diff --git a/crypto/bio/bss_mem.c b/crypto/bio/bss_mem.c index f8c144accd..c4e557822e 100644 --- a/crypto/bio/bss_mem.c +++ b/crypto/bio/bss_mem.c @@ -166,6 +166,8 @@ static int mem_read(BIO *b, char *out, int outl) if (b->num != 0) BIO_set_retry_read(b); ret= b->num; + if(ret < 0) + BIOerr(BIO_F_MEM_READ,BIO_R_EOF_ON_MEMORY_BIO); } return(ret); } |