TTY_get() in crypto/ui/ui_openssl.c open_console() can also return errno 1 (EPERM...
authorMaxim Zakharov <5158255+Maxime2@users.noreply.github.com>
Fri, 8 May 2020 04:58:10 +0000 (14:58 +1000)
committerMatt Caswell <matt@openssl.org>
Mon, 18 May 2020 09:05:21 +0000 (10:05 +0100)
Signed-off-by: Maxim Zakharov <5158255+Maxime2@users.noreply.github.com>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11767)

(cherry picked from commit 082394839ea32386abc7ee33aaa9da864287064c)

crypto/ui/ui_openssl.c

index 168de4630dcc01388451cba22f27adbeb2ce5fed..6830bd25c2d7d7a23adca0886130263534706788 100644 (file)
@@ -439,6 +439,16 @@ static int open_console(UI *ui)
             is_a_tty = 0;
         else
 #  endif
+#  ifdef EPERM
+            /*
+             * Linux can return EPERM (Operation not permitted),
+             * e.g. if a daemon executes openssl via fork()+execve()
+             * This should be ok
+             */
+        if (errno == EPERM)
+            is_a_tty = 0;
+        else
+#  endif
 #  ifdef ENODEV
             /*
              * MacOS X returns ENODEV (Operation not supported by device),