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>
Sat, 10 Dec 2016 09:22:10 +0000 (10:22 +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 377384b050f9c377cbdb0664ed9f468058013190..17d14f58427afaab8f11bec70c35c539efabed20 100644 (file)
@@ -508,6 +508,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
             return 0;
     }