summaryrefslogtreecommitdiffstats
path: root/crypto/ui
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2016-12-08 11:16:37 +0100
committerRichard Levitte <levitte@openssl.org>2016-12-08 13:34:08 +0100
commit4984448648f69ed4425df68900b1fd6f17c6c271 (patch)
treef8b1a3bbeeb76753de16aea8fcece367d619c17e /crypto/ui
parent57c0f378b8fdbdc55dba783e9b744b8ed2132819 (diff)
In UI_OpenSSL's open(), generate an error on unknown errno
TTY_get() sometimes surprises us with new errno values to determine if we have a controling terminal or not. This generated error is a helpful tool to figure out that this was what happened and what the unknown value is. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2043)
Diffstat (limited to 'crypto/ui')
-rw-r--r--crypto/ui/ui_err.c3
-rw-r--r--crypto/ui/ui_openssl.c10
2 files changed, 12 insertions, 1 deletions
diff --git a/crypto/ui/ui_err.c b/crypto/ui/ui_err.c
index b89f9aebb5..eaaa4f58e9 100644
--- a/crypto/ui/ui_err.c
+++ b/crypto/ui/ui_err.c
@@ -21,6 +21,7 @@
static ERR_STRING_DATA UI_str_functs[] = {
{ERR_FUNC(UI_F_GENERAL_ALLOCATE_BOOLEAN), "general_allocate_boolean"},
{ERR_FUNC(UI_F_GENERAL_ALLOCATE_PROMPT), "general_allocate_prompt"},
+ {ERR_FUNC(UI_F_OPEN_CONSOLE), "open_console"},
{ERR_FUNC(UI_F_UI_CREATE_METHOD), "UI_create_method"},
{ERR_FUNC(UI_F_UI_CTRL), "UI_ctrl"},
{ERR_FUNC(UI_F_UI_DUP_ERROR_STRING), "UI_dup_error_string"},
@@ -45,6 +46,8 @@ static ERR_STRING_DATA UI_str_reasons[] = {
{ERR_REASON(UI_R_RESULT_TOO_LARGE), "result too large"},
{ERR_REASON(UI_R_RESULT_TOO_SMALL), "result too small"},
{ERR_REASON(UI_R_UNKNOWN_CONTROL_COMMAND), "unknown control command"},
+ {ERR_REASON(UI_R_UNKNOWN_TTYGET_ERRNO_VALUE),
+ "unknown ttyget errno value"},
{0, NULL}
};
diff --git a/crypto/ui/ui_openssl.c b/crypto/ui/ui_openssl.c
index bdd07f90d3..a9acd98b4a 100644
--- a/crypto/ui/ui_openssl.c
+++ b/crypto/ui/ui_openssl.c
@@ -8,6 +8,7 @@
*/
#include <openssl/e_os2.h>
+#include <openssl/err.h>
/*
* need for #define _POSIX_C_SOURCE arises whenever you pass -ansi to gcc
@@ -428,7 +429,14 @@ static int open_console(UI *ui)
is_a_tty = 0;
else
# endif
- return 0;
+ {
+ char tmp_num[10];
+ BIO_snprintf(tmp_num, sizeof(tmp_num) - 1, "%d", errno);
+ UIerr(UI_F_OPEN_CONSOLE, UI_R_UNKNOWN_TTYGET_ERRNO_VALUE);
+ ERR_add_error_data(2, "errno=", tmp_num);
+
+ return 0;
+ }
}
#endif
#ifdef OPENSSL_SYS_VMS