From 18a6333180f2e49393276972fc43449a6e17ed45 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Sun, 21 Mar 2004 22:36:27 +0000 Subject: [PATCH] Make sure fd is defined where it should. PR: 849 --- crypto/bio/bss_file.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crypto/bio/bss_file.c b/crypto/bio/bss_file.c index f36bec2864..d4c058a1e4 100644 --- a/crypto/bio/bss_file.c +++ b/crypto/bio/bss_file.c @@ -213,6 +213,8 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) b->shutdown=(int)num&BIO_CLOSE; b->ptr=(char *)ptr; b->init=1; + { + int fd = fileno((FILE*)ptr); #if defined(OPENSSL_SYS_WINDOWS) if (num & BIO_FP_TEXT) _setmode(fd,_O_TEXT); @@ -222,12 +224,10 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) /* Under CLib there are differences in file modes */ if (num & BIO_FP_TEXT) - _setmode(fileno((FILE *)ptr),O_TEXT); + _setmode(fd,O_TEXT); else - _setmode(fileno((FILE *)ptr),O_BINARY); + _setmode(fd,O_BINARY); #elif defined(OPENSSL_SYS_MSDOS) - { - int fd = fileno((FILE*)ptr); /* Set correct text/binary mode */ if (num & BIO_FP_TEXT) _setmode(fd,_O_TEXT); @@ -242,13 +242,13 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) else _setmode(fd,_O_BINARY); } - } #elif defined(OPENSSL_SYS_OS2) if (num & BIO_FP_TEXT) - setmode(fileno((FILE *)ptr), O_TEXT); + setmode(fd, O_TEXT); else - setmode(fileno((FILE *)ptr), O_BINARY); + setmode(fd, O_BINARY); #endif + } break; case BIO_C_SET_FILENAME: file_free(b); -- 2.40.0