crypto/ui/ui_openssl.c: make sure to recognise ENXIO and EIO too
authorRichard Levitte <levitte@openssl.org>
Wed, 19 Sep 2018 19:33:45 +0000 (21:33 +0200)
committerRichard Levitte <richard@levitte.org>
Thu, 20 Sep 2018 04:40:52 +0000 (06:40 +0200)
These both indicate that the file descriptor we're trying to use as a
terminal isn't, in fact, a terminal.

Fixes #7271

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/7272)

(cherry picked from commit 276bf8620ce35a613c856f2b70348f65ffe94067)

crypto/ui/ui_openssl.c

index 45d48202b5613ddcedfc51ba1cdd288b0eff16f3..6b996134df49e43da4a93f399f44b040ac1d93ae 100644 (file)
@@ -415,6 +415,24 @@ static int open_console(UI *ui)
             is_a_tty = 0;
         else
 #  endif
+#  ifdef ENXIO
+            /*
+             * Solaris can return ENXIO.
+             * This should be ok
+             */
+        if (errno == ENXIO)
+            is_a_tty = 0;
+        else
+#  endif
+#  ifdef EIO
+            /*
+             * Linux can return EIO.
+             * This should be ok
+             */
+        if (errno == EIO)
+            is_a_tty = 0;
+        else
+#  endif
 #  ifdef ENODEV
             /*
              * MacOS X returns ENODEV (Operation not supported by device),