From baa2abd0a4dd6584adc4a3e329cc286fafab13a9 Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Thu, 26 Jun 2014 15:24:08 +0000 Subject: save errno in ERR_put_error(), so that SYSerr doesn't have any accidental cases where errno can be trashed. ok jsing --- src/lib/libcrypto/err/err.c | 4 +++- src/lib/libssl/src/crypto/err/err.c | 4 +++- 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 @@ -/* $OpenBSD: err.c,v 1.33 2014/06/12 15:49:29 deraadt Exp $ */ +/* $OpenBSD: err.c,v 1.34 2014/06/26 15:24:08 deraadt Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -702,6 +702,7 @@ void ERR_put_error(int lib, int func, int reason, const char *file, int line) { ERR_STATE *es; + int save_errno = errno; es = ERR_get_state(); @@ -713,6 +714,7 @@ ERR_put_error(int lib, int func, int reason, const char *file, int line) es->err_file[es->top] = file; es->err_line[es->top] = line; err_clear_data(es, es->top); + save_errno = errno; } void 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 @@ -/* $OpenBSD: err.c,v 1.33 2014/06/12 15:49:29 deraadt Exp $ */ +/* $OpenBSD: err.c,v 1.34 2014/06/26 15:24:08 deraadt Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -702,6 +702,7 @@ void ERR_put_error(int lib, int func, int reason, const char *file, int line) { ERR_STATE *es; + int save_errno = errno; es = ERR_get_state(); @@ -713,6 +714,7 @@ ERR_put_error(int lib, int func, int reason, const char *file, int line) es->err_file[es->top] = file; es->err_line[es->top] = line; err_clear_data(es, es->top); + save_errno = errno; } void -- cgit v1.2.3-55-g6feb