UI_OpenSSL()'s session opener fails on MacOS X
authorRichard Levitte <levitte@openssl.org>
Wed, 7 Dec 2016 19:28:43 +0000 (20:28 +0100)
committerRichard Levitte <richard@levitte.org>
Thu, 8 Dec 2016 13:10:19 +0000 (14:10 +0100)
If on a non-tty stdin, TTY_get() will fail with errno == ENODEV.
We didn't catch that.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2039)
(cherry picked from commit c901bccec6f747467e1af31473655c8290e32309)

crypto/ui/ui_openssl.c

index cd25a6d9714db5ac88b340e79b155fb272e3dbe8..1965d1e19d94b0d39caf6c0dbe8f995ba6755382 100644 (file)
@@ -423,6 +423,15 @@ static int open_console(UI *ui)
         if (errno == EINVAL)
             is_a_tty = 0;
         else
+# endif
+# ifdef ENODEV
+            /*
+             * MacOS X returns ENODEV (Operation not supported by device),
+             * which seems appropriate.
+             */
+        if (errno == ENODEV)
+            is_a_tty = 0;
+        else
 # endif
             {
                 char tmp_num[10];