Fix for new UI functions under Win32.
authorDr. Stephen Henson <steve@openssl.org>
Thu, 17 May 2001 11:47:08 +0000 (11:47 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Thu, 17 May 2001 11:47:08 +0000 (11:47 +0000)
For some unknown reason fopen("con", "w") is the
only way to make this work. Using "r+" and "w+"
causes the fopen call to fail and the fallback
(using stdin) doesn't work because writing to stdin
fails.

crypto/ui/ui_openssl.c

index 3555ae6275c8f906b20072570962e0c774abddc7..abf223b5d154a1f765add510e304d0b66d8f89c8 100644 (file)
@@ -430,7 +430,10 @@ static int open_console(UI *ui)
        is_a_tty = 1;
 
 #ifdef OPENSSL_SYS_MSDOS
-       if ((tty=fopen("con","w+")) == NULL)
+       /* For some bizarre reason this call to fopen() on Windows 
+         * fails if the mode is "w+" or "r+", whereas "w" works fine.
+        */
+       if ((tty=fopen("con","w")) == NULL)
                tty=stdin;
 #elif defined(OPENSSL_SYS_MACINTOSH_CLASSIC)
        tty=stdin;