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 <levitte@openssl.org>
Thu, 8 Dec 2016 12:37:48 +0000 (13:37 +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)

crypto/ui/ui_openssl.c

index a9acd98b4a12cf778788295098890920bf1ba750..00ad2b6992930005ee30f8c1716bbb2578c6f0bb 100644 (file)
@@ -428,6 +428,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];