summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorderaadt <>2014-06-26 15:24:08 +0000
committerderaadt <>2014-06-26 15:24:08 +0000
commitbaa2abd0a4dd6584adc4a3e329cc286fafab13a9 (patch)
treef32429a788a7c6a268c7792555b69ad2b553a61d /src
parent272318b99b9ff154eca3a465c90d6d27361c58c9 (diff)
downloadopenbsd-baa2abd0a4dd6584adc4a3e329cc286fafab13a9.tar.gz
openbsd-baa2abd0a4dd6584adc4a3e329cc286fafab13a9.tar.bz2
openbsd-baa2abd0a4dd6584adc4a3e329cc286fafab13a9.zip
save errno in ERR_put_error(), so that SYSerr doesn't have any accidental
cases where errno can be trashed. ok jsing
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/err/err.c4
-rw-r--r--src/lib/libssl/src/crypto/err/err.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c
index 2f19dc276b..4ea756003a 100644
--- a/src/lib/libcrypto/err/err.c
+++ b/src/lib/libcrypto/err/err.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: err.c,v 1.33 2014/06/12 15:49:29 deraadt Exp $ */ 1/* $OpenBSD: err.c,v 1.34 2014/06/26 15:24:08 deraadt Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -702,6 +702,7 @@ void
702ERR_put_error(int lib, int func, int reason, const char *file, int line) 702ERR_put_error(int lib, int func, int reason, const char *file, int line)
703{ 703{
704 ERR_STATE *es; 704 ERR_STATE *es;
705 int save_errno = errno;
705 706
706 es = ERR_get_state(); 707 es = ERR_get_state();
707 708
@@ -713,6 +714,7 @@ ERR_put_error(int lib, int func, int reason, const char *file, int line)
713 es->err_file[es->top] = file; 714 es->err_file[es->top] = file;
714 es->err_line[es->top] = line; 715 es->err_line[es->top] = line;
715 err_clear_data(es, es->top); 716 err_clear_data(es, es->top);
717 save_errno = errno;
716} 718}
717 719
718void 720void
diff --git a/src/lib/libssl/src/crypto/err/err.c b/src/lib/libssl/src/crypto/err/err.c
index 2f19dc276b..4ea756003a 100644
--- a/src/lib/libssl/src/crypto/err/err.c
+++ b/src/lib/libssl/src/crypto/err/err.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: err.c,v 1.33 2014/06/12 15:49:29 deraadt Exp $ */ 1/* $OpenBSD: err.c,v 1.34 2014/06/26 15:24:08 deraadt Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -702,6 +702,7 @@ void
702ERR_put_error(int lib, int func, int reason, const char *file, int line) 702ERR_put_error(int lib, int func, int reason, const char *file, int line)
703{ 703{
704 ERR_STATE *es; 704 ERR_STATE *es;
705 int save_errno = errno;
705 706
706 es = ERR_get_state(); 707 es = ERR_get_state();
707 708
@@ -713,6 +714,7 @@ ERR_put_error(int lib, int func, int reason, const char *file, int line)
713 es->err_file[es->top] = file; 714 es->err_file[es->top] = file;
714 es->err_line[es->top] = line; 715 es->err_line[es->top] = line;
715 err_clear_data(es, es->top); 716 err_clear_data(es, es->top);
717 save_errno = errno;
716} 718}
717 719
718void 720void