From 7015be7e487c936fda9b4981ba162c0cc1b837de Mon Sep 17 00:00:00 2001 From: jsing <> Date: Tue, 7 Feb 2017 15:52:33 +0000 Subject: Revert previous; the implementation is incorrect since it assumes that the provided error code matches the error that is currently on the top of the error stack. --- src/lib/libcrypto/err/err.c | 21 ++++----------------- src/lib/libcrypto/err/err_prn.c | 6 +++--- 2 files changed, 7 insertions(+), 20 deletions(-) (limited to 'src/lib') diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c index dcf725fd64..1b235c1653 100644 --- a/src/lib/libcrypto/err/err.c +++ b/src/lib/libcrypto/err/err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: err.c,v 1.43 2017/02/07 03:11:11 beck Exp $ */ +/* $OpenBSD: err.c,v 1.44 2017/02/07 15:52:33 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -862,9 +862,8 @@ void ERR_error_string_n(unsigned long e, char *buf, size_t len) { char lsbuf[30], fsbuf[30], rsbuf[30]; - const char *ls, *fs, *rs, *file, *data; - int l, f, r, ret, line, flags; - + const char *ls, *fs, *rs; + int l, f, r, ret; l = ERR_GET_LIB(e); f = ERR_GET_FUNC(e); @@ -887,19 +886,7 @@ ERR_error_string_n(unsigned long e, char *buf, size_t len) rs = rsbuf; } - if (ERR_get_error_line_data(&file, &line, &data, &flags) != 0) { - const char *filename; - - if ((filename = strrchr(file, '/')) != NULL) - filename++; - else - filename = file; - - ret = snprintf(buf, len, "error:%08lX:%s:%s:%s:%s:%d", e, ls, - fs, rs, filename, line); - } else - ret = snprintf(buf, len, "error:%08lX:%s:%s:%s", e, ls, fs, rs); - + ret = snprintf(buf, len, "error:%08lX:%s:%s:%s", e, ls, fs, rs); if (ret == -1) return; /* can't happen, and can't do better if it does */ if (ret >= len) { diff --git a/src/lib/libcrypto/err/err_prn.c b/src/lib/libcrypto/err/err_prn.c index 6a3062a89a..48166829d4 100644 --- a/src/lib/libcrypto/err/err_prn.c +++ b/src/lib/libcrypto/err/err_prn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: err_prn.c,v 1.17 2017/02/07 03:11:11 beck Exp $ */ +/* $OpenBSD: err_prn.c,v 1.18 2017/02/07 15:52:33 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -80,8 +80,8 @@ ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u), void *u) while ((l = ERR_get_error_line_data(&file, &line, &data, &flags)) != 0) { ERR_error_string_n(l, buf, sizeof buf); - (void) snprintf(buf2, sizeof(buf2), "%lu:%s:%s\n", es, - buf, (flags & ERR_TXT_STRING) ? data : ""); + (void) snprintf(buf2, sizeof(buf2), "%lu:%s:%s:%d:%s\n", es, + buf, file, line, (flags & ERR_TXT_STRING) ? data : ""); if (cb(buf2, strlen(buf2), u) <= 0) break; /* abort outputting the error report */ } -- cgit v1.2.3-55-g6feb