From: Richard Levitte Date: Sun, 21 Mar 2004 22:36:30 +0000 (+0000) Subject: Make sure fd is defined where it should. X-Git-Tag: OpenSSL_0_9_7e~144 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=96a99d63c24c9f313e54fc21cdf73b9e9c26a78d;p=oweals%2Fopenssl.git Make sure fd is defined where it should. PR: 849 --- diff --git a/crypto/bio/bss_file.c b/crypto/bio/bss_file.c index 9cdf159f82..554474733f 100644 --- a/crypto/bio/bss_file.c +++ b/crypto/bio/bss_file.c @@ -213,14 +213,14 @@ 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(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); @@ -235,13 +235,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);