diff options
author | Richard Levitte <levitte@openssl.org> | 2003-09-28 07:11:33 +0000 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2003-09-28 07:11:33 +0000 |
commit | 7f3ba9428f29dd424267f75fa2de7d0fe513a6c9 (patch) | |
tree | d5558361f330faa62edd1ff2f17cae84b34693c3 | |
parent | 3c02e24bb3bfe966549ca242c36d54b985abe1b5 (diff) | |
download | openssl-new-7f3ba9428f29dd424267f75fa2de7d0fe513a6c9.tar.gz |
Uhmm, It seem to have forgotten one file when I committed the MSDOS
change yesterday.
PR: 669
-rw-r--r-- | crypto/bio/bss_file.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/crypto/bio/bss_file.c b/crypto/bio/bss_file.c index a66600c1a3..1f9bd3312a 100644 --- a/crypto/bio/bss_file.c +++ b/crypto/bio/bss_file.c @@ -213,12 +213,29 @@ 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; -#if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) +#if defined(OPENSSL_SYS_WINDOWS) + if (num & BIO_FP_TEXT) + _setmode(fd,_O_TEXT); + else + _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(fileno((FILE *)ptr),_O_TEXT); + _setmode(fd,_O_TEXT); + /* Dangerous to set stdin/stdout to raw (unless redirected) */ else - _setmode(fileno((FILE *)ptr),_O_BINARY); + { + if (fd == STDIN_FILENO || fd == STDOUT_FILENO) + { + if (isatty(fd) <= 0) + _setmode(fd,_O_BINARY); + } + else + _setmode(fd,_O_BINARY); + } + } #elif defined(OPENSSL_SYS_OS2) if (num & BIO_FP_TEXT) setmode(fileno((FILE *)ptr), O_TEXT); |