diff options
author | Andy Polyakov <appro@openssl.org> | 2016-04-06 12:21:14 +0300 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2016-04-07 22:08:08 +0300 |
commit | 800b299b0a53c871be57c4b2c97c95d6642489ea (patch) | |
tree | 172de32bb4ee1405384c9f34b619a62ac54e5697 /crypto/bio/bss_file.c | |
parent | a4ccf06808422400a6a0673b452d388e95a455fd (diff) |
bio/bss_file.c: since VS2015 one can't tell apart own and "alien" FILE
pointers, except for minimal std[in|out|err].
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/bio/bss_file.c')
-rw-r--r-- | crypto/bio/bss_file.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crypto/bio/bss_file.c b/crypto/bio/bss_file.c index 643a855a8d..081c7f1632 100644 --- a/crypto/bio/bss_file.c +++ b/crypto/bio/bss_file.c @@ -241,7 +241,7 @@ static int file_read(BIO *b, char *out, int outl) ret = fread(out, 1, (int)outl, (FILE *)b->ptr); if (ret == 0 && (b->flags & BIO_FLAGS_UPLINK) ? UP_ferror((FILE *)b->ptr) : - ferror((FILE *)b->ptr)) { + ferror((FILE *)b->ptr)) { SYSerr(SYS_F_FREAD, get_last_sys_error()); BIOerr(BIO_F_FILE_READ, ERR_R_SYS_LIB); ret = -1; @@ -308,8 +308,11 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr) # if defined(__MINGW32__) && defined(__MSVCRT__) && !defined(_IOB_ENTRIES) # define _IOB_ENTRIES 20 # endif -# if defined(_IOB_ENTRIES) /* Safety net to catch purely internal BIO_set_fp calls */ +# if defined(_MSC_VER) && _MSC_VER>=1900 + if (ptr == stdin || ptr == stdout || ptr == stderr) + BIO_clear_flags(b, BIO_FLAGS_UPLINK); +# elif defined(_IOB_ENTRIES) if ((size_t)ptr >= (size_t)stdin && (size_t)ptr < (size_t)(stdin + _IOB_ENTRIES)) BIO_clear_flags(b, BIO_FLAGS_UPLINK); |