summaryrefslogtreecommitdiff
path: root/e_os.h
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2018-11-21 11:44:42 +0000
committerMatt Caswell <matt@openssl.org>2018-12-10 10:17:43 +0000
commit71b1ceffc4c795f5db21861dd1016fbe23a53a53 (patch)
treebca0e9d4c6a3842cb06b20ed0f4c8783be6a8b9f /e_os.h
parentf2f734d4f9e34643a1d3e5b79d2447cd643519f8 (diff)
downloadopenssl-new-71b1ceffc4c795f5db21861dd1016fbe23a53a53.tar.gz
Make sure build_SYS_str_reasons() preserves errno
This function can end up being called during ERR_get_error() if we are initialising. ERR_get_error() must preserve errno since it gets called via SSL_get_error(). If that function returns SSL_ERROR_SYSCALL then you are supposed to inspect errno. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7680)
Diffstat (limited to 'e_os.h')
-rw-r--r--e_os.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/e_os.h b/e_os.h
index 6cdd35e6e1..9c0888e436 100644
--- a/e_os.h
+++ b/e_os.h
@@ -49,6 +49,7 @@
# define get_last_sys_error() errno
# define clear_sys_error() errno=0
+# define set_sys_error(e) errno=(e)
/********************************************************************
The Microsoft section
@@ -66,8 +67,10 @@
# ifdef WIN32
# undef get_last_sys_error
# undef clear_sys_error
+# undef set_sys_error
# define get_last_sys_error() GetLastError()
# define clear_sys_error() SetLastError(0)
+# define set_sys_error(e) SetLastError(e)
# if !defined(WINNT)
# define WIN_CONSOLE_BUG
# endif